I wanted to create a little script to save time on all the "feedback" forms I put on websites. Something where you can point any form to it, and it will print the data on screen (and eventually email).

This is working great, except for checkboxes. its only showing the last checkbox as the value. I've tried inserting an is_array() into the loop to specially process checkboxes, etc. but I can't get it to work. How do I process the checkboxes so it shows all selections on screen?

Checkboxes are unique elements, each name must be unique. Radios on the other hand are grouped according to the name, thus must be same.

If you want all the checkboxes to be grouped together, you can use them as an array

name='geography[]'

guido2004
—
2010-10-20T17:58:34Z —
#3

name="geography[B][][/B]"

Notice the square brackets behind the checkbox name. This way, $POST['geography'] will contain an array. Do a printr to see exactly what is being sent.

ripcurlksm
—
2010-10-20T18:18:46Z —
#4

thats right... I'm just used to processing checkboxes as arrays, I did it by habit.

Won, renaming the checkbox names did the trick and will do the trick I believe.

guido, thanks for picking up on misnaming the checkbox without "[]" to make it an array. print_r($POST) works great, but I would like a way to format it to make it look more readable. I'm trying something like this (not working) where I test to see if there is an array within the array, but no luck yet.