Jump to content

Dynamic menu and set page id="here"


select

Recommended Posts

Hi, I am trying to do a dynamic menu based on page id.

 

This is what I got:

 

$id = clean($_GET['id']);
$current_page = $id;

if($current_page == $id) 
{
echo 'id="here"';
}

 

This is how I get the menu from the database:

 

while($row = mysql_fetch_assoc($result) )
{
	echo "<li>" . "<a href=" . $row['mlink'] . " title=" . $row['mtitle'] . ">" . $row['mname'] . "</a>" . "</li>";
}

 

Can I somehow work the if $current_page statement into the <a> tag and assign the id to the link?

Link to comment
https://forums.phpfreaks.com/topic/180407-dynamic-menu-and-set-page-idhere/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.