|
-
Jan 7th, 2010, 11:22 PM
#1
Thread Starter
Addicted Member
if statement in menulist
hi
i want to display an item from the menulist only if id=5 but i am having problem combining the php and html
my code
Code:
<ul class="menulist">
<li><a href="index.php" title="Item One" class="current">Plan change</a></li>
<li> <a href="temp.php" title="Item Two">Search </a></li>
</ul>
now i want to display
Code:
<li> <a href="temp.php" title="Item Two">Search </a></li>
only if id=5
any idea on that ?
-
Jan 8th, 2010, 01:58 AM
#2
Re: if statement in menulist
but, where is the ID variable? how is it defined? are you looping through an array and want to display this extra HTML on the fifth item..? or, what? all you've posted is HTML. I could simply give you code that would display some HTML if the "ID" is equal to 5, but ... that doesn't sound like it would be very helpful, because if you were doing a database request or something there's no real reason that you wouldn't know what an IF statement looks like.. right?
"the code":
PHP Code:
<?php if($id == 5){ ?> <li><a href="blah">Search</a></li> <?php } ?>
but, like I stated earlier, if $id is never defined then this won't do anything.
help us out by posting the rest of your code or at least giving a more detailed explanation of what you're looking for.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|