Re: explode won't explode

From: Date: Fri, 27 Apr 2001 12:41:55 +0000
Subject: Re: explode won't explode
Groups: php.general 
Request: Send a blank email to php-general+get-50606@lists.php.net to get a copy of this message
Hiya, > I have the following code that doesn't seem to "explode." I'm trying to > make > a field that looks like 21,23,25,27 or small,medium,large,x-large into a > pulldown menu with the individual item broken out. > > if (($size != "") && ($size != "n/a")) { > $sizearry = explode(",", $size); > while (list($key,$value) = each($sizearry)) { > $size_option_block .= "<option > value=\"$value\">$size</option>\n"; > } I think you've used the wrong varaible between <option></option>. You should have $value, but you've put in the original variable: $size. > The interesting thing (and probably the problem) is that I have very similar > code just before it that works fine. Here's the code that appears just > before and works. > > if (($color != "") && ($color != "n/a")) { > $colorarry = explode(",", $color); > while (list($key,$value) = each($colorarry)) { > $color_option_block .= "<option > value=\"$value\">$value</option>\n"; > } > > I'm not that familiar with explode. Are my $key and $value variables > conflicting? > > > > >>>>.>>.>>>.>>>>>.>>>>>>>>>.>>>>>>>> > Tom Beidler > Orbit Tech Services > 805.682.8972 (phone) > 805.682.5833 (fax) > tom@orbittechservices.com > http://www.orbittechservices.com/ > > >>>>.>>.>>>.>>>>>.>>>>>>>>>.>>>>>>>>

« previous php.general (#50606) next »