PrimeR Posted August 18, 2009 Share Posted August 18, 2009 How do you create a drop down menu in which the array selections contain links? (In other words, it's like a regular form drop down menu with a list of products for example, except selecting an option from it immediately takes the user to the info page for the product selected. No submit button needed.) Link to comment https://forums.phpfreaks.com/topic/170859-solved-form-drop-down-menu-in-which-selection-immediately-links-to-new-page/ Share on other sites More sharing options...
flyhoney Posted August 18, 2009 Share Posted August 18, 2009 This is a javascript question not a PHP question. You can use the select element's onchange event to trigger an even that will change location.href. i.e. <script type="text/javascript"> function changeLocation() { var select = document.getElementById("myselect"); var href = select.options[select.selectedIndex].value; location.href = href; } </script> <select id="myselect" onchange="changeLocation()"> <option value="http://www.google.com">Google</option> </select> Link to comment https://forums.phpfreaks.com/topic/170859-solved-form-drop-down-menu-in-which-selection-immediately-links-to-new-page/#findComment-901126 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.