Hi all,
I want to populate a field with a database tables data based on a users selection.
The user selects an investment type from a select menu.
The select menu is populated by database table.
<select name="investment_type" id="investment_type">
<option value="0">Select Investment Type</option>
<?php
while($row = mssql_fetch_array($result))
{
echo '<optionvalue="'.$row['inv_ID'].'">'.$row['inv_type'].'</option>';
}
?>
</select>
Then based on the users selection another field should be populated with relevant data from the same table...
<p>
<label for="note">Note</label>
<textarea cols="" rows="" name="note" id="note"></textarea>
</p>
Any ideas how this is done?
Tried something like below involving javascript...
<select name="inv_type" onchange="change();">
<option value="<?php echo $test ?>">Test</option>
<option value="two">Two</option>
</select>
The JS:
function change() {
document.getElementById('note').innerHTML = document.frm_name.inv_type.value;
}
That seems to work ok but I need to use inv_ID in the option value and have inv_note data appear in other field.
Thanks.