Re: re: Dropdown Menu Woes

From: Date: Fri, 08 Dec 2000 00:04:36 +0000
Subject: Re: re: Dropdown Menu Woes
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-29251@lists.php.net to get a copy of this message
On Thu, 07 Dec 2000, Roy W wrote: > Tried that - no go. > > :-( > > http://www.divadallas.org/php/colorform1.html > > Thanks though > > > jmcazurin <mikah@info.com.ph> wrote in message > news:5.0.0.25.0.20001207195425.00ab3050@pop.info.com.ph... > > > > Hi Roy, > > > > Not sure why that happens, but you could try: > > > > while(...) { > > ... > > print "<option>" . $color . "</option>"; > > ... > > } > > > > Hope this helps. > > > > Mikah > > > > At 07:27 PM 12/7/00, Roy W wrote: > > >Having trouble creating a drop-down menu using the following code: > > > > > >....more code > > ><FORM method="POST" action="formresult.php3"> > > >Pick a color:<select size="1" name="colorselect"> > > ><? > > >...more php code > > > WHILE ($i < $number): > > > $color = mysql_result($result,$i,"color"); > > > echo htmlentities("<option>$color</option>"); > > > /* also tried but no-go: PRINT "<option>$color</option>"; > > > */ > > > $i++; > > > ENDWHILE; > > >?> > > >....more code > > > > > >The above puts the string: "$color" into the dropdown menu I may be a bit late in this sdiscussion, but I'll chuck my A$0.02 in anyhow. First, your select should look approx like this itf you want a value to pass: <SELECT> <OPTION VALUE="value">Label </SELECT> So your code might look like this: WHILE ($i < $number): $color = mysql_result($result,$i,"color"); $color = htmlentities($color); echo "<option VALUE=\"$color\">$color</option>"); $i++; ENDWHILE; But I wonder why you are using htmlentities here? -- David Robley | WEBMASTER & Mail List Admin RESEARCH CENTRE FOR INJURY STUDIES | http://www.nisu.flinders.edu.au/ AusEinet | http://auseinet.flinders.edu.au/ Flinders University, ADELAIDE, SOUTH AUSTRALIA

« previous php.general (#29251) next »