|
Posted by Kye on 10/18/07 11:55
I am attempting to use the below Select Form Element to allow users to
change the category of data being viewed in a subsequent SQL statement. My
problem is, from where I am at, what is my next step to be able to do an "if
then else" loop based upon what is selected from this form element???
TIA
Kye.
<?php
$category = "SELECT * FROM `links_categories` ORDER BY category ASC LIMIT
0 , 30" or die('Error, query failed');
$catlist = mysql_query($category) or die('Error, query failed');
echo "<form method=\"post\" action=\"{$_SERVER['PHP_SELF']}\">";
echo '<SELECT name="dropdown">';
echo "<OPTION> - Please Select A Category - </OPTION>\n";
while ($row = mysql_fetch_array($catlist, MYSQL_NUM)){
echo "<OPTION value=$row[0]>{$row[1]}</OPTION>\n";
}
echo '</SELECT>';
echo "<INPUT type='submit' value='Go'>";
echo "</form>";
?>
[Back to original message]
|