|
Posted by Jerry Stuckle on 10/18/07 16:55
Kye wrote:
> 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>";
> ?>
>
>
>
>
Have a page which takes the value in $_POST['dropdown'] and performs
another SQL query of the desired results.
It may be this page (i.e. if $_POST['dropdown'] is set, or a different
page, depending on your needs.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
Navigation:
[Reply to this message]
|