I have the following code and I am attempting to dynamically complete the City and State fields, if there is a Location Code entered.
I am stuck, any advice would be great!
Thanks..
<Tr>
<Td>Location Code:</td>
<td>
<?php
$db = mysql_connect("localhost", "name", "password") or die
("Couldn't connect to server.");
mysql_select_db("trailerdamage",$db) or die ("Couldn't select database.");
$result = mysql_query("SELECT * FROM locations Order by locationcode",$db);
echo "<select name=loccode>";
if ($myrow = mysql_fetch_array($result)) {
do {
echo "<option value=$myrow[locationcode]>$myrow[locationcode]</option>\n";
$city = ($city);
}
while ($myrow = mysql_fetch_array($result));
echo "</select>";
}
?>
</td>
</tr>
<tr>
<td>City: <font size="1" color="red">*Required</font></td>
<td>
<input type=text name=city value="<?php ("$city";) ?> ">
</td>
</tr>
<tr>
<td>State: <font size="1" color="red">*Required</font></td>
<td><select name="state" value="<?php ("$state";) ?>>
<option></option> <option>CT</option>
<option>DE</option>
<option>IL</option>
<option>IN</option>
<option>MA</option>
<option>MD</option>
<option>NH</option>
<option>NJ</option>
<option>NY</option>
<option>OH</option>
<option>PA</option>
<option>VA</option>
<option>VT</option>
<option></option>
</select>
</td>
</tr>