bbw82 Posted December 3, 2011 Share Posted December 3, 2011 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 https://forums.phpfreaks.com/topic/252365-issue-when-sending-a-form-that-has-multiple-check-boxes-selected/ Share on other sites More sharing options...
bbw82 Posted December 3, 2011 Author Share Posted December 3, 2011 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 https://forums.phpfreaks.com/topic/252365-issue-when-sending-a-form-that-has-multiple-check-boxes-selected/#findComment-1293798 Share on other sites More sharing options...
trq Posted December 3, 2011 Share Posted December 3, 2011 Check that $_POST['TestGroup'] isset before using it. Link to comment https://forums.phpfreaks.com/topic/252365-issue-when-sending-a-form-that-has-multiple-check-boxes-selected/#findComment-1293816 Share on other sites More sharing options...
Errant_Shadow Posted December 3, 2011 Share Posted December 3, 2011 This problem is solved then? Link to comment https://forums.phpfreaks.com/topic/252365-issue-when-sending-a-form-that-has-multiple-check-boxes-selected/#findComment-1293843 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.