> 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"

$string = implode(",",$graphicFormat);

To see how many checkboxes were selected, use

$num = count($graphicFormat);

---John Holmes...


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to