Parsing an array from a posted form
| From: | Verdon Vaillancourt | Date: | Wed, 20 Nov 2002 19:56:40 +0000 |
| Subject: | Parsing an array from a posted form | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-125311@lists.php.net to get a copy of this message | ||
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