Jump to content

Select item in list menu to determine the options in another list menu


yandoo

Recommended Posts

Hi all,

 

I is possible to have a list/menu in a form that when the user selects an option from it, the result then determines what options are avaliable in another list/menu (the 2nd list/menus table needs to be matched with whatever the the results of the 1st menu are) on the same form.

 

Is it possible???

 

Thank You :)

Hi

 

Hope this starts you on what you need .

 

<form id="form1" name="form1" method="post" action="<?=$PHP_SELF?>">

<select name="select0">
  <option value="1"<? if ($_POST['select0']==1) {echo 'selected="selected"' ;} ?>>1 to 5</option>
  <option value="2" <? if ($_POST['select0']==2) {echo 'selected="selected"' ;} ?>>6-10</option>
</select> 
-
<select name="select1">
<?
if ($_POST['select0']==1)
{
for($i=1;$i<=5;$i++)
{
	echo '<option>'.$i.'</option>' ;
}
}

if ($_POST['select0']==2)
{
for($i=6;$i<=10;$i++)
{
	echo '<option>'.$i.'</option>' ;
}
}
?>
</select>
<br />
<br />
<input type="submit" name="Submit" value="Submit" />

</form>

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.