Hi all.
Having looked but can not find a solution, can this be done.
I have a table (airports) that contains 2 fields.
field 1 = airport_name
field 2 = iata_code
I have a form which has a dropdown list which gets its content from the airports table using field 2 (airport_names).
What I am trying to do is when a user selects the name of an airport, field 2 (iata_code) is updated to the corrosponding record.
example
if a table row contains:
airport name = Heathrow
iata code = HEA
When "heathrow" is selected the iata code field displays "HEA".
The code I am using is:
<select name="f_location" id="f_location" class="bodytext">
<?php
do {
?>
<option value="<?php echo $row_airport['code']?>"><?php echo $row_airport['name']?></option>
<?php
} while ($row_airport = mysql_fetch_assoc($airport));
$rows = mysql_num_rows($airport);
if($rows > 0) {
mysql_data_seek($airport, 0);
$row_airport = mysql_fetch_assoc($airport);
}
?>
</select>
Can this be done with PHP