Jump to content

[SOLVED] Pulldown menu help


9999

Recommended Posts

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

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>";
?>

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.