Jump to content

Issue when sending a form that has multiple check boxes selected


bbw82

Recommended Posts

I have a form that has a section where you can pick multiple check boxes and when the info is returned to me it has the word Array at the end of it.

 

There are 2 check boxes on the form one fo Steve and one for Ben

 

Below is the code I am using in my PHP file

 

foreach($_POST['TestGroup'] as $val)

{

  echo $val . "\n";

}

 

The output from the PHP code is----Steve Ben Array.------

 

How do I keep Array from coming up?

 

Link to comment
Share on other sites

I found a solution and am now using the following code

 

$testgroup = implode('.',$_POST['TestGroup']);

 

The issue I am having now is if there are no checkboxes selected in the form I get the following error

 

Warning: implode() [function.implode]: Invalid arguments passed in /home/a5078204/public_html/process.php on line 6

 

Is there a way to keep it from giving a warning message if no checkboxes are selected?

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.