Jump to content

Welcome to Geeks to Go - Register now for FREE

Need help with your computer or device? Want to learn new tech skills? You're in the right place!
Geeks to Go is a friendly community of tech experts who can solve any problem you have. Just create a free account and post your question. Our volunteers will reply quickly and guide you through the steps. Don't let tech troubles stop you. Join Geeks to Go now and get the support you need!

How it Works Create Account
Photo

checkbox array help


  • Please log in to reply

#1
mikhael

mikhael

    Member

  • Member
  • PipPip
  • 39 posts
I am making a rather large form for one of my sites and I have a section asking interests using checkboxes. I wanted all of the checkboxes to have the same name but a value corrisponding to the interest. I then attempted to call these variables in php with the post command but I am having issues.

<input name="checkbox[]" type="checkbox" value="value1" />

<input name="checkbox[]" type="checkbox" value="value2" />

<input name="checkbox[]" type="checkbox" value="value3" />  

<input name="checkbox[]" type="checkbox" value="value4" />

<input name="checkbox[]" type="checkbox" value="value5" />

<input name="checkbox[]" type="checkbox" value="value6" />

now in the php script I want to use each value but for example's sake lets just echo the selected values

<?php
$box = is_array($_POST['checkbox']);

echo $box;
?>

except all I get is the word "Array" to echo. What am I doing wrong?
  • 0

Advertisements


#2
Metallica

Metallica

    Spyware Veteran

  • GeekU Moderator
  • 33,101 posts
is_array($_POST)

That only checks if it exists if I'm not mistaking.

Maybe this will help you:
http://phpprogrammin...n-form-element/
  • 0






Similar Topics

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

As Featured On:

Microsoft Yahoo BBC MSN PC Magazine Washington Post HP