RE: Drop down menu with PHP
| From: | Rolf van de Krol | Date: | Mon, 05 Apr 2004 13:48:06 +0000 |
| Subject: | RE: Drop down menu with PHP | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-33754@lists.php.net to get a copy of this message | ||
Hi Charles,
If you mean columns when you say rows the answer is no. When you mean rows
when your saying rows the answer is yes. That's what you are doing with your
code below.
Rolf
///////////////////////////////////////////////
/ Suicidal twin kills sister by mistake! /
///////////////////////////////////////////////
-----Oorspronkelijk bericht-----
Van: The Image Builder [mailto:tibuildr@myexcel.com]
Verzonden: maandag 5 april 2004 4:01
Aan: php-db@lists.php.net
Onderwerp: Drop down menu with PHP
Hello,
I have code for a drop down menu that works fine. But, though I only want
the results from one row to fill the form, I want it to show 2 rows in the
drop down menu. Can I do that? I would appreciate your help. Here is what
I have now:
<? mysql_connect("localhost","user","password");
mysql_select_db("database");
$sql = "select distinct category from books ORDER BY category ASC";
$makes_result = mysql_query($sql);
print ("<select name=\"category\">\n");
print("<option selected value=\"\">Please select a
Category</option>\n");
while($row = mysql_fetch_row($makes_result))
{
print("<option value=\"$row[0]\">$row[0]</option>\n");
}
print("</select>"); ?>
Thanks in advance
Charles