You are here: Re: $_SERVER['PHP_SELF'] Question « PHP Programming Language « IT news, forums, messages
Re: $_SERVER['PHP_SELF'] Question

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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация