Page 1 of 1

Help with Drop down lists

Posted: Wed Oct 22, 2008 4:18 am
by varun_146100
Hi ,

Am a newbie to PHP and have been working with drop down lists.
I have a drop down list with 3 options.
Like i have 3 options available there i.e new/cancel/update.
Now i need to generate another 2-3 drop down lists after selection of either of these options above.
For example if i select update 3 different drop down lists should be generated on the screen.
How should i do this...Please help.

Re: Help with Drop down lists

Posted: Wed Oct 22, 2008 4:34 am
by papa
...
<select name="first" onchange='this.form.submit()'>
<option value="form1">Form1</option>
<option value="form2">Form2</option>
<option value="form3">Form3</option>
</select>
...

Code: Select all

<?php
$first = $_POST['first'];
if(!empty($_POST['first']) {
 
switch($first) {
case "form1":
echo "select 1";
break;
case "form2":
echo "select 2";
break;
case "form3":
echo "select 3";
break;
}
}
?>
Fast and ugly :)

Re: Help with Drop down lists

Posted: Wed Oct 22, 2008 4:37 am
by aceconcepts
If you want to process this via the client-side you could take a look at "chained select menus".

Here's a link: http://www.dynamicdrive.com/dynamicinde ... /index.htm