Select list with PHP
| From: | Gerry | Date: | Sat, 03 Feb 2001 22:24:38 +0000 |
| Subject: | Select list with PHP | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-37983@lists.php.net to get a copy of this message | ||
Hello:
I'm trying to create dinamic color SELECT lists with php. I have my
database set up as follows:
Paint = good
bucket = good
weight = 100kg
Colors = green, blue, red
and here is my php:
while ($row = mysql_fetch_array($sql_result)) {
echo"<tr><td>";
echo $row["paint"];
echo"</td><td>";
echo $row["bucket"];
echo"</td><td>";
echo"<form action=\"http://www.\"
method=\"POST\">";
$Color = $row["Color"];
if ($Color == $Color) {
$option .= "<OPTION value=\"$Color\" selected>$Color</OPTION>";
} else {
$option .= "<OPTION value=\"$Color\">$Color</OPTION>";
}
echo"<select name=\"Colors\">";
echo "$option";
echo"</select>";
as you can see I end up with a select menu with this "green, blue, red"
as the only option.
is there a way I can tell php3 to break it down at "," so I can actually
have a drop down menu
Thanks ahead:
Gerry Figueroa
----------------------------------
Modern Confucius:
Man who run in front of car get tired.
----------------------------------