logo-dw

Go Back   Dreamweaver Club Forums > Hand Coders Forum > PHP
Register FAQ Members List Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Display Modes
Old 03-23-2012, 01:45 PM   #1
tony09uk
 
Join Date: Oct 2010
Posts: 340
Default echoing multiple check boxes

I have created some checkboxes and would like to echo the ones the user selects.

I have created this:

--------------------------------------------------------------------------

page one:

Bike<input type="checkbox" name="vehicle" value="Bike" /><br/>
Car<input type="checkbox" name="vehicle" value="Car" /><br/>
bus<input type="checkbox" name="vehicle" value="bus" /><br/>
train<input type="checkbox" name="vehicle" value="train" /><br/>
plane<input type="checkbox" name="vehicle" value="plane" /><br/>
other<input type="checkbox" name="vehicle" value="other" /><br/>

page two - (processing):

$vehicle = $_POST['vehicle'];

echo $vehicles

--------------------------------------------------------------------------

It only echo's the last box selected. I have had a play with different loops and feel they are the answer, but I am looking for some guidance on how to create a loop that will achieve my goal.....so far all I have achieved is error messages
tony09uk is offline   Reply With Quote
Old 03-24-2012, 03:26 AM   #2
edbr
edbr's Avatar
 
Join Date: Aug 2005
Location: Bali
Posts: 11,164
Default

vehicle with multiple select becomes an array do the form should be
Bike<input type="checkbox" name="vehicle[]" value="Bike" />
__________________
If you're happy and you know it shake your meds!
different style links examples

Flight / Hotel search
Free script download
Bali Villas
edbr is online now   Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 06:36 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Copyright 2006 DreamweaverClub.com