Newbie: Multiple Checkbox options outputs "Array"

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
rosslad2004
Forum Newbie
Posts: 5
Joined: Fri Feb 18, 2005 2:34 pm

Newbie: Multiple Checkbox options outputs "Array"

Post by rosslad2004 »

Hello there.

Really sorry if this has been asked before, I have been searching for 2 days and havent managed to find it :cry:

I am trying to submit a form that includes multiple checkboxes which are in an array into a mysql database where the results can be viewed on a seperate page later.

But the only output i am getting is the word "Array"

I know i have done something wrong somewhere but can't figure it out.

My forms method is "post"

and the code for the checkboxes:

Code: Select all

<input type="checkbox" name="bodytype&#1111;]" value="Average" /> Average
<input type="checkbox" name="bodytype&#1111;]" value="Above Average" /> Above Average 
<input type="checkbox" name="bodytype&#1111;]" value="Below Average" /> Below Average
with:

Code: Select all

if ( is_array($_POST&#1111;'bodytype']) ) 
&#123; 
   $cat_list = implode(',', $_POST&#1111;'bodytype']); 
&#125; else &#123; 
   $cat_list = ''; 
&#125;
If anyone can see whats wrong with this, please point it out.

Any help would be much appreciated.
Regards
Ross
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

make sure they are coming across correctly using print_r($_POST) or similar..
Post Reply