Page 1 of 1

[56k Warn] Checkboxes in PHP Form Processor

Posted: Tue Aug 16, 2005 10:48 am
by nickman013
Hello,

I have 12 checkboxes on my form and when people pick more than one checkbox, my email sends back the results and it only views one of the selected checkboxes. I need them to show all.

Here are some pictures.

This is the actual form with the selected checkboxes.
Image

This is the results that come back in my E-Mail is.
Image

This is in the mail script that processes the form.
Image
Even if I have one of them listed, It only views one still.
This is the form script.
Image

Any help will be great.

Thanks

Posted: Tue Aug 16, 2005 11:12 am
by shiznatix
EDIT:

what i would do since you have the $coveragesCurrently over and over on the process page just change the name of the checkboxes on the form to CoveragesCurrently TO -> CoveragesCurrently[] then do on the process page...

Code: Select all

foreach ($_POST['CoveragesCurrently'] as $key => $value)
{
  if ($key == 0)
    echo $value;
  else
    echo ' ,'.$value;
}
adding the [] to the end of the name will make it an array and then you can access each element chosen in the array with the foreach loop. i just put in the if ($key) part to make the commas nice and neat

Posted: Tue Aug 16, 2005 11:20 am
by John Cartwright
In the futur post code as text and not images so it is easier for us to modify/improve/point out specifics.

Posted: Wed Aug 17, 2005 1:30 am
by nickman013
i get a parse error on line 2.

line 2 is

"foreach ($_POST['CoveragesCurrently'] as $key => $value) "

Posted: Wed Aug 17, 2005 12:40 pm
by josh

Code: Select all

print_r($_POST['CoveragesCurrently']);
Did the variables get sent from the form?

Posted: Sat Aug 20, 2005 8:34 am
by nickman013
jshpro2 wrote:

Code: Select all

print_r($_POST['CoveragesCurrently']);
Did the variables get sent from the form?
Where would I put this can you show me a example, please

thank you

Posted: Sun Aug 21, 2005 1:49 pm
by nickman013
If anyone knows please tell me.

Thanks Alot!!