9999 Posted February 7, 2007 Share Posted February 7, 2007 This pulldown works on my html pages but not on my php pages. I believe an "echo" needs to be added to some of the lines. Could someone give me the proper syntax. Thanks in advance. <SCRIPT LANGUAGE="JavaScript"> <!-- Begin function formHandler(form){ var URL = document.form.site.options[document.form.site.selectedIndex].value; window.location.href = URL; } // End --> </SCRIPT> <center> <form name="form"> <select name="site" size=1 onChange="javascript:formHandler()"> <option value="">Select Another Page <option value="http://www.yoursite.com/page2.html">Page 2</option> <option value="http://www.yoursite.com/page3.html">Page 3</option> <option value="http://www.yoursite.com/page4.html">Page 4</option> </select> </form> </center> Link to comment https://forums.phpfreaks.com/topic/37498-solved-pulldown-menu-help/ Share on other sites More sharing options...
alpine Posted February 7, 2007 Share Posted February 7, 2007 Normally it should work just aswell in a php file as long as you have this outside any php tags. What's the problem then? Link to comment https://forums.phpfreaks.com/topic/37498-solved-pulldown-menu-help/#findComment-179353 Share on other sites More sharing options...
9999 Posted February 8, 2007 Author Share Posted February 8, 2007 I changed to this and still nothing happens when I select from the list. I want it to go to the selection automatically without a "submit"button. <SCRIPT LANGUAGE="JavaScript"> <!-- Begin function formHandler(form){ var URL = document.form.site.options[document.form.site.selectedIndex].value; window.location.href = URL; } // End --> </SCRIPT> <?php echo " <center> <form name='form'> <select name='site' size=1 onChange='javascript:formHandler()'> <option value=''>Select Another Page <option value='http://www.yoursite.com/page2.html'>Page 2</option> <option value='http://www.yoursite.com/page3.html'>Page 3</option> <option value='http://www.yoursite.com/page4.html'>Page 4</option> </select> </form> </center>"; ?> Link to comment https://forums.phpfreaks.com/topic/37498-solved-pulldown-menu-help/#findComment-180196 Share on other sites More sharing options...
9999 Posted February 8, 2007 Author Share Posted February 8, 2007 I solved it. Apparently another pulldown next to this one "interfered" with this one, as I removed it and now this works. Link to comment https://forums.phpfreaks.com/topic/37498-solved-pulldown-menu-help/#findComment-180222 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.