Re: Parsing an array from a posted form

From: Date: Wed, 20 Nov 2002 20:03:59 +0000
Subject: Re: Parsing an array from a posted form
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-125314@lists.php.net to get a copy of this message
you can use the implode() function: for ($z=0;$z<count($graphicFormat);$z++) { $graphicFormat = stripslashes($graphicFormat[$z]); } echo implode(", ", $graphicFormat); "Verdon Vaillancourt" <vern@verdon.ca> wrote in message news:BA015328.52E8%vern@verdon.ca... > Hi All :) > > I have a form that is being passed to a mail function when submitted. It is > working OK, except that I am having trouble with values from arrays such as > checkbox lists. For example, I have a list such as: > > <input type="checkbox" name="graphicFormat[]" value="eps" > /> .eps > <input type="checkbox" name="graphicFormat[]" value="jpg" > /> .jpg > <input type="checkbox" name="graphicFormat[]" value="tif" > /> .tif > <input type="checkbox" name="graphicFormat[]" value="gif" > /> .gif > <input type="checkbox" name="graphicFormat[]" value="png" > /> .png > <input type="checkbox" name="graphicFormat[]" value="psd" > /> .psd > <input type="checkbox" name="graphicFormat[]" value="bmp" > /> .bmp > <input type="checkbox" name="graphicFormat[]" value="other" > /> other > > I am using something like: > > for ($z=0;$z<count($graphicFormat);$z++) { > $graphicFormat = stripslashes($graphicFormat[$z]); > } > > Which will return a count of the number of items in the array. What I want > returned is a string of the values selected such as: > > "eps, gif, other" > > Any suggestions? > > Best Regards, > verdon > > Ps. Please cc me as I am on digest mode > Pps. Please excuse if my question is TOO fundamental >

« previous php.general (#125314) next »