How do you make a Dynamic Form auto populate fields?
I am using PHP and mySQL.
I have a fully functional DataAssist Insert form that inserts records into a mySQL table.
For the first two inputs on the form, I have separate dynamic combo boxes that read from 2 separate recordsets. These queries look for specific information from different tables. If the 1st combo box selection is chosen, it will change the options in the second combo box. When the 2nd combo box is selected, the data that is chosen will dynamically determine what will auto populate the remaining text boxes with initial values. The remaining form fields will not have initial values until the 2nd combo box is selected.
1st Combo Box to get the Name for Table1
<select size="1" id="name" name="name">
<option value="-1" selected>Not Selected</option>
<?php
do {
?>
<option value="<?php echo $row_getTable1['record_id']; ?>"><?php echo $row_getTable1['name']; ?></option>
<?php
} while ($row_getTable1 = mysql_fetch_assoc($getTable1));
$rows = mysql_num_rows($getTable1);
if($rows > 0) {
mysql_data_seek($getTable1, 0);
$row_getTable1 = mysql_fetch_assoc($getTable1);
}
?>
</select>
2nd Combo Box to get the Department for Table2
<select size="1" id="department" name="department">
<option value="-1" selected>Not Selected</option>
<?php
do {
?>
<option value="<?php echo $row_getTable2['record_id']; ?>"><?php echo $row_getTable2['department']; ?></option>
<?php
} while ($row_getTable2 = mysql_fetch_assoc($getTable2));
$rows = mysql_num_rows($getTable2);
if($rows > 0) {
mysql_data_seek($getTable2, 0);
$row_getTable2 = mysql_fetch_assoc($getTable2);
}
?>
</select>
How is this accomplished?