Hi-
I am creating a basic form that posts data to a mySQL database. One of my tables, called "sites", contains the following information: site_name, site_id. I have created a dynamic dropdown menu of the sites (so the dropdown menu references the table "sites" to display all site names in a dropdown list). Based on the site_name selection, I would like the site_id to automatically populate the next text box in my form. **Here's the catch. I do not want to use any java or ajax. ** Please excuse the messy code, I deleted a lot of the private information. Thank you for your help in advance.
<html>
<form action="mait.php" method="post">
Site Name:
<?php
mysql_connect("localhost", "root", "") or die(mysql_error());
mysql_select_db("database1") or die(mysql_error());
$sql = "SELECT site_name FROM sites ORDER BY site_name";
echo "<SELECT name='mait_site'>";
$result = mysql_query($sql);
while ($row = mysql_fetch_assoc($result)) {
echo '<option value="'.$row["site_name"].'">'
.$row["site_name"].'</option>';
}
echo "</SELECT>";
?>
Site ID:
<<<<<neeed this field automatically populated based on Site Name selection>>>>>
</form>
</html>