View Full Version : Auto drop down box

07-11-2007, 11:32 PM
I am trying to create 2 drop down boxes, for example Country and state so when country is selected it will show in the second drop down box the correct list of states.

I know how to do it with an if command in the second box but it requires a form to be submit but because it is already a form, how would I make a form inside a form work?


07-12-2007, 12:17 AM
If you want a hidden dropdown to without a page load, you will have to look into a javascript solution. This can't be done with php.

07-12-2007, 12:38 AM
Dont mind page load I just don't know how to do it because its already in a form how would you do it?

07-12-2007, 12:43 AM
I don't see a php-based solution as being very intuitive. You wouldn't need a form inside a form, but rather the user would submit the form with the country selected, you would then redisplay the page (or another page) with the state dropdown included, and the user would resubmit the form.

07-12-2007, 02:57 AM
i think you can do it like this and this is how i have done..

<th colspan="4" scope="col"><select name="select" id="select" >
<option value="value" value="value"<?php if (!(strcmp("value", $_SESSION['KT_eDept']))) {echo "SELECTED";} ?> <?php if (!(strcmp("value", $_SESSION['KT_eDept']))) {echo "SELECTED";} ?>>
Select Dept...
<option value="<?php echo $rs_section->Fields('DEPT_NAME')?>"<?php if (!(strcmp($rs_section->Fields('DEPT_NAME'), $_SESSION['KT_eDept']))) {echo "SELECTED";} ?>><?php echo $rs_section->Fields('DEPT_NAME')?></option>
<select name="select2" id="select2" wdg:subtype="DependentDropdown" wdg:type="widget" wdg:recordset="rs_section2" wdg:displayfield="SECTION" wdg:valuefield="SECTION" wdg:fkey="DEPT_NAME" wdg:triggerobject="select">
<option>Select Section...</option>