[56k Warn] Checkboxes in PHP Form Processor

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
nickman013
Forum Regular
Posts: 764
Joined: Sun Aug 14, 2005 12:02 am
Location: Long Island, New York

[56k Warn] Checkboxes in PHP Form Processor

Post 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
User avatar
shiznatix
DevNet Master
Posts: 2745
Joined: Tue Dec 28, 2004 5:57 pm
Location: Tallinn, Estonia
Contact:

Post 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
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post 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.
User avatar
nickman013
Forum Regular
Posts: 764
Joined: Sun Aug 14, 2005 12:02 am
Location: Long Island, New York

Post by nickman013 »

i get a parse error on line 2.

line 2 is

"foreach ($_POST['CoveragesCurrently'] as $key => $value) "
josh
DevNet Master
Posts: 4872
Joined: Wed Feb 11, 2004 3:23 pm
Location: Palm beach, Florida

Post by josh »

Code: Select all

print_r($_POST['CoveragesCurrently']);
Did the variables get sent from the form?
User avatar
nickman013
Forum Regular
Posts: 764
Joined: Sun Aug 14, 2005 12:02 am
Location: Long Island, New York

Post 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
User avatar
nickman013
Forum Regular
Posts: 764
Joined: Sun Aug 14, 2005 12:02 am
Location: Long Island, New York

Post by nickman013 »

If anyone knows please tell me.

Thanks Alot!!
Post Reply