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

Thread Tools Display Modes
Old 03-23-2012, 02:45 PM   #1
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, 04:26 AM   #2
edbr's Avatar
Join Date: Aug 2005
Location: Bali
Posts: 11,187

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 offline   Reply With Quote

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 01:45 PM.

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