...

View Full Version : Auto drop down box



drewjy2k
07-11-2007, 10: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?

Thanks:thumbsup:

PappaJohn
07-11-2007, 11:17 PM
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.

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

PappaJohn
07-11-2007, 11:43 PM
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.

NiZAM
07-12-2007, 01: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><?php
while(!$rs_section->EOF){
?>
<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>
<?php
$rs_section->MoveNext();
}
$rs_section->MoveFirst();
?>
</select>
<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>
</select></th>
</tr>



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum