when you select a value from a dynamic dropdown, how can i get other values from the same row of that database?
ex:
dropdown: Home / School / Office /
When they select Home, i want to get the values for address, city, zip and show them on a textboxes (or a hidden field)?
Here's my code:
Code: Select all
function generate_department($conn){
$departments="";
$query = "SELECT DISTINCT address, city, zip, dept FROM tblDepartment";
$result = odbc_exec($conn,$query);
while ($return = odbc_fetch_array($result)){
$departments.="<option value='".htmlentities($return["dept"])."'>".$return[dept]."</option>";
}
return $departments;
}here's my dropdown:
Code: Select all
<select size="1" name="Department">
<option value="">Select One</option>
<?php echo generate_department($db); ?>
</select>dropdown works fine, now i want to see my address, city, and zip and place them on a separte textboxes (or a hidden field)
...
my goal is to get all these values then write them on a separate database
any help would be appreciated... thanks!