I'd like to have a form that does the following:
User picks a site from a dropdown list from a MySQL db (that works -
code below, thanks to all those on the web who posted code for this).
Once the value is selected, a second query is run using the site as the
'where' clause and the results are displayed back to the user.
Any help for this mysql, php, htlm noob. I think once I get this bit,
I'll be able to move forward with more interesting and complex code.
TIA
Doug
ps - if this message shows up 3 times, my apologies but I've been having
trouble posting.
<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($si tequery);
// use results
echo "Select a site from the list below: <br><br><sele ct name='site'>";
while($siterow = mysql_fetch_arr ay($siteresult) )
echo "<option
value='".$siter ow["site"]."'>".$siter ow["site"]."</option>";
echo "</select></td>";
?>
</body>
</html>
User picks a site from a dropdown list from a MySQL db (that works -
code below, thanks to all those on the web who posted code for this).
Once the value is selected, a second query is run using the site as the
'where' clause and the results are displayed back to the user.
Any help for this mysql, php, htlm noob. I think once I get this bit,
I'll be able to move forward with more interesting and complex code.
TIA
Doug
ps - if this message shows up 3 times, my apologies but I've been having
trouble posting.
<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($si tequery);
// use results
echo "Select a site from the list below: <br><br><sele ct name='site'>";
while($siterow = mysql_fetch_arr ay($siteresult) )
echo "<option
value='".$siter ow["site"]."'>".$siter ow["site"]."</option>";
echo "</select></td>";
?>
</body>
</html>
Comment