Stuck on basic concept, how to use a list selection?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I want to:
Populate a dropdown list with values from a MySQL db (done and working).
Use the selected value as the 'where' clause in a second query.
Return the results and display them to the user.

Any pointers are appreciated - noob^3 (html, mysql, and php).

Doug

Code that I'm using:

<html>
<body>
<?php

// connect to db
$db = mysql_connect("localhost");
mysql_select_db("test",$db);

// build query
$sitequery = "SELECT site from sitedata order by site";

// generate result set
$siteresult = mysql_query($sitequery);

// use results
echo "Select a site from the list below: <br><br><select name='site'>";
while($siterow = mysql_fetch_array($siteresult))
    echo "<option value='".$siterow["site"]."'>"
$siterow["site"]."</option>";
echo "</select></td>";

?>

</body>
</html>

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux