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 :)

Link to comment
Share on other sites

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>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.