Re: Select list with PHP/oops!

From: Date: Sun, 04 Feb 2001 16:32:11 +0000
Subject: Re: Select list with PHP/oops!
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-38102@lists.php.net to get a copy of this message
Well I messed up... I forgot to add the final ";} at the bottom of my sample code but here it is. sorry! Gerry wrote: > > This worked! > But, I get this color selection increment on each subsequent menu where > the colors from the row above mix with the ones below and so on. Assume > that the numbers are the actual colors: > > Select a color: > ---------------------------- > first menu1 next menu-> 1 next menu-> even longer > 2 2 > 3 3 > 4 4 > 5 5 > 1 > 2 > 3 > 4 > 5 > ----------------------------------------------- > mysql_connect(); > 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\">"; > $Colors = $row["Color"]; > $options = explode(",", $Colors); > while (list(,$Color) = each($options)){ > $option .= "<OPTION>$Color</OPTION>\n"; > } > echo"<select name=\"Colors\">"; > echo "$option"; > echo"</select>"; > echo"</td></tr>"; > echo"</form>"; } -------------------------------------- > > > It's usually a better idea to store this as a "relation": > > I'm afraid so. > > Thanks: > Gerry Figueroa > > ----------------- > Modern Confucious: > Man who run behind car get exhausted.

« previous php.general (#38102) next »