Li element selection.
Posted: Fri Oct 16, 2009 8:06 am
I have the following code:
All this code does is create a menu list with named locations - London, Coventry etc. The CSS code is tucked away.
However, what I'd like to achieve is to be able to select the menu item and save it so that I can do the following:
All this code does is to select the last menu item. I've used onClick within the <href...> tag but again nothing happens!
How do I capture the menu selection so that I can post it back to the page using main.php?location
Many thanks.
Code: Select all
while ($result = display_tree($num))
{
echo"<ul>
<li>";
while ($row = mysql_fetch_array($result))
{
if ($row["menuID"] == 0)
{
echo "<a href='main.php'>".$row["locationName"]."</a>"; // output county
}
else
{
echo "<ul>
<li><a href='main.php'>".$row["locationName"]."</a></li></ul>"; // output location - based in county
}
}
echo"</li></ul>";
$num++;
mysql_free_result($result);
}
However, what I'd like to achieve is to be able to select the menu item and save it so that I can do the following:
Code: Select all
echo "<ul>
<li><a href='main.php'?$locationName>".$row["locationName"]."</a></li></ul>";
How do I capture the menu selection so that I can post it back to the page using main.php?location
Many thanks.