August 16th, 2013, 10:40 PM
Drop down menu and hyperlinks in PHP
Trying to hyperlink items in drop down menu. Menu items pulled from table fine. Hyperlinks won't work. Thanks.
$query = "SELECT catid, name from categories ORDER BY catid ASC";
$result = mysql_query($query);
$catid = $row['catid'];
$name = $row['name'];
echo '<option onClick=\"'index.php?content=buyproducts&cat=$catid'\">$name</option>';
echo '<option value=\"'.$catid.'\">'.$name.'</option>';
Last edited by requinix; August 16th, 2013 at 11:29 PM.
Reason: [php] is for code, [phpnet] is for linking to the manual
August 17th, 2013, 12:39 AM
You can't make a hyperlink in a SELECT control. The look/layout of a SELECT is up to the browser designer. All you can give is the text to be displayed.
I think what you really want is an onChange handler on the select control.
August 17th, 2013, 01:44 AM
Originally Posted by BarryG
August 17th, 2013, 03:16 PM
Comments on this post