Fill In Multiple Selection Boxes From One Selection Box Sele
Posted: Thu Jul 19, 2007 8:21 am
I have a selection box at the top of my web site and then I have a bunch of rows printed out into a table from a MySQL database below that selection box.
Each one of these rows has a selection box in the first column.
I want the selection box that is at the top of all of these rows of data to fill the same value in as it if I select a value from it.
So if I select "Apples" from the selection box at the top of the table of data rows then all of the selection boxes in the table below would fill in with Apples.
Here is the code that the selection box at the top of the table of data rows has:
Here is the code that each one of the selection boxes in the table has:
If an inspector is select in that top box I want all of the selection boxes below to fill in with that inspector.
Each one of these rows has a selection box in the first column.
I want the selection box that is at the top of all of these rows of data to fill the same value in as it if I select a value from it.
So if I select "Apples" from the selection box at the top of the table of data rows then all of the selection boxes in the table below would fill in with Apples.
Here is the code that the selection box at the top of the table of data rows has:
Code: Select all
<select name="assign_all" class="mediumInput">
<option value="">Select An Inspector</option>
<?php
$result1 = mysql_query("SELECT * FROM users WHERE account_type='Inspector' ORDER BY username ASC");
while($row1 = mysql_fetch_array($result1)) {
?>
<option value="<?php echo $row1["user_code"]; ?>"><?php echo $row1["username"]; ?></option>
<?php
}
?>
</select>Code: Select all
<select name="inspector[<?php echo $row["id"]; ?>]" class="smallInput">
<option value="">Select An Inspector</option>
<?php
$result1 = mysql_query("SELECT * FROM users WHERE account_type='Inspector' ORDER BY username ASC");
while($row1 = mysql_fetch_array($result1)) {
?>
<option value="<?php echo $row1["user_code"]; ?>"><?php echo $row1["username"]; ?></option>
<?php
}
?>
</select>