Hello.
I am working on a project where I need to have a dropdown list of states that when you choose one, it returns a list of clients out of a database. For instance, you choose Texas, and John Doe and Bob White who live in Houston and Dallas respectively is returned.
I'm new with returning info from a database, and can pull all results, but I cannot get the dropdown menu to work. I don't even really have any idea at all on how to... Any suggestions?
My current code:
My database is set up simply. Each of the states is abbreviated (TX, NJ, TN, WA, etc).
I am working on a project where I need to have a dropdown list of states that when you choose one, it returns a list of clients out of a database. For instance, you choose Texas, and John Doe and Bob White who live in Houston and Dallas respectively is returned.
I'm new with returning info from a database, and can pull all results, but I cannot get the dropdown menu to work. I don't even really have any idea at all on how to... Any suggestions?
My current code:
PHP:
<?php
$con = mysql_connect("****","****","****");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
// Select DB
mysql_select_db("****", $con);
$result = mysql_query("SELECT * FROM graduates");
while($row = mysql_fetch_array($result))
{
echo "<div style='border:1px solid black; width: 600px; margin: 5px; padding: 5px;'><div style='float:left;' class='gradfind_left'><div><strong>" . $row['first_name'] . " " . $row['last_name'] . "</strong></div><div>" . $row['city'] . ", " . $row['state'] ." ". $row['zipcode'] ."</div></div>";
echo "<div style='float:right;' class='gradfind_right'>" . "(" . $row['area_code'] . ") " . $row['phone'] . "</div><br style='clear:both;' /></div>";
}
?>
My database is set up simply. Each of the states is abbreviated (TX, NJ, TN, WA, etc).