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?

 

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?

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.