Welcome Guest ( Log In | Join )

Discover the best free computer help!
Learn more about Geeks to Go by taking the tour. Want to ask a question, reply to a topic, or remove all advertising? It's easy, fast and free. Join today!
Spyware, virus, trojan, fake security or privacy alerts? Please start with our malware cleaning guide.
     
 
Reply to this topicStart new topic
checkbox array help, passing values for multiple checkboxes
mikhael
post Nov 9 2008, 11:34 PM
Post #1


Member
**
Posts: 35
OS: Windows XP



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.

CODE

<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

CODE

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

echo $box;
?>


except all I get is the word "Array" to echo. What am I doing wrong?
Go to the top of the page
 
+Quote Post
Metallica
post Nov 12 2008, 05:20 AM
Post #2


Spyware Veteran
Group Icon
Posts: 20,960
From: Netherlands
OS: XP Pro & Vista Ultimate



is_array($_POST)

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

Maybe this will help you:
http://phpprogramming.wordpress.com/2007/0...n-form-element/
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Collapse

> Similar Topics

    Topic Title Replies / Views Topic Information
No New Posts   6 / 609 24th January 2007 - 03:22 PM
Joeturf started - last by Ctrl_Alt_Del
No New Posts   2 / 243 9th July 2007 - 07:46 PM
Lungfixer started - last by cmw2010
No New Posts   3 / 515 12th May 2008 - 05:11 PM
digikiwi started - last by Neil Jones
No New Posts   0 / 302 12th June 2008 - 07:31 AM
rps2 started - last by rps2

RSS Time is now: 8th January 2009 - 01:25 AM
Advertisements do not imply our endorsement of that product or service. The forum is run by volunteers who donate their time and expertise. We make every attempt to ensure that the help and advice posted is accurate and will not cause harm to your computer. However, we do not guarantee that they are accurate and they are to be used at your own risk.