Forum Moderators: open

Message Too Old, No Replies

Forms for page reload

I am trying to reload a page using a select box in a form

         

Mouse0_0

2:30 pm on Nov 20, 2002 (gmt 0)

10+ Year Member



I am trying to create a dynamic page in PHP whose content is altered by reloading the page using parameters passed from a selection drop-down box in a form.

Currently the form includes the box and a "Go" submit button, and works fine, but is there a way to remove the "Go" button so that when a selection is made in the drop-down box, the page will immediately reload with no further action from the user?

Thanks for any assistance with this, sorry if it's a novice-type question.

Andy

seindal

3:01 pm on Nov 20, 2002 (gmt 0)

10+ Year Member



You need javascript to react to a simple change in a menu.

Something like this will do

<form action="#">
<select name="page" onChange="location.href=this.options[this.selectedIndex].value;">
<option value="/sight/86.html" SELECTED>1. Introduction</option>
<option value="/sight/86-1.html" >2. Poseidonia - The Greek City</option>
<option value="/sight/86-2.html" >3. The Lucanian Conquest</option>
<option value="/sight/86-3.html" >4. Paestum - The Roman Colony</option>
<option value="/sight/86-4.html" >5. Decline and Disappearance</option>
<option value="/sight/86-5.html" >6. Rediscovery</option>
<option value="/sight/86-6.html" >7. Literature and links</option>
<option value="/sight/86-7.html" >8. Photographs</option>
</select>
</form>

You need the onchange handler to <select> and the value on <option>.

René.

lars stecken

3:02 pm on Nov 20, 2002 (gmt 0)

10+ Year Member



<form name="myForm">
<select name="myName" onchange="docment.myForm.submit()">
<option value="1">1</option>
</select>
</form>

Damian

3:06 pm on Nov 20, 2002 (gmt 0)

10+ Year Member



Mouse...think this does what you want..:
.. make the form like this..

<FORM NAME="form" METHOD="post" ACTION="">

<SELECT NAME="where" onChange=self.location.href=self.document.form.where.options[selectedIndex].value>

<option selected>Choose your option</option>
<option value="something">something1</option>
<option value="something2">something2</option>
</select>
</FORM>

<added>..whoops..you got plenty of help already..:)...</added>