HTMLisEasy.com
HTML tutorials for the rest of us...

Now a question might come to mind... What if I want to ask 3 different questions about the same group of guys?? How, Mr Smartypants am I going to do that!

Well, just settle down and I'll show you.

Which of these guys are your friends?
Ed Holleran
Rick Weinberg
Tom Studd
Burgermeister Meisterburger
Which of these guys would you lend money to?
Ed Holleran
Rick Weinberg
Tom Studd
Burgermeister Meisterburger
Which of these guys would you trust with your sister?
Ed Holleran
Rick Weinberg
Tom Studd
Burgermeister Meisterburger

It's true that except for radio buttons, in each form there should never be duplicate names. So, maybe we could use a different name for each question. (When I say never, I don't mean that your computer will blow up... at most it might confuse the browser or the form handler. At the very least it will confuse the poor sap that has to make sense of the form data.)

What follows is the html for these 3 questions. The <table> tags are in blue. They are for appearance only, they don't affect how the form works. If you need to brush up on your table tags, then stumble on over to Table Tutor.

<form>
<table border="1"><tr valign="top"><td width="33%">
Which of these guys are your friends?<br>
<input type="checkbox" name="Friend - Ed"   value="yes">Ed Holleran<br>
<input type="checkbox" name="Friend - Rick" value="yes">Rick Weinberg<br>
<input type="checkbox" name="Friend - Tom"  value="yes">Tom Studd<br>
<input type="checkbox" name="Friend - BM"   value="yes">Burgermeister Meisterburger
</td><td width="34%">
Which of these guys would you lend money to?<br>
<input type="checkbox" name="Lend money - Ed"   value="yes">Ed Holleran<br>
<input type="checkbox" name="Lend money - Rick" value="yes">Rick Weinberg<br>
<input type="checkbox" name="Lend money - Tom"  value="yes">Tom Studd<br>
<input type="checkbox" name="Lend money - BM"   value="yes">Burgermeister Meisterburger
</td><td width="33%">
Which of these guys would you trust with your sister?<br>
<input type="checkbox" name="Date sister - Ed"   value="yes">Ed Holleran<br>
<input type="checkbox" name="Date sister - Rick" value="yes">Rick Weinberg<br>
<input type="checkbox" name="Date sister - Tom"  value="yes">Tom Studd<br>
<input type="checkbox" name="Date sister - BM"   value="yes">Burgermeister Meisterburger
</td></tr></table>
</form>


Let's suppose the user checked the following boxes...

Which of these guys are your friends?
Ed Holleran
Rick Weinberg
Tom Studd
Burgermeister Meisterburger
Which of these guys would you lend money to?
Ed Holleran
Rick Weinberg
Tom Studd
Burgermeister Meisterburger
Which of these guys would you trust with your sister?
Ed Holleran
Rick Weinberg
Tom Studd
Burgermeister Meisterburger

Doing that would send you the following name/value pairs...

Friend - Ed=yes
Friend - Rick=yes
Friend - Tom=yes
Lend money - Tom=yes
Lend money - BM=yes
Date sister - Ed=yes
Date sister - Rick=yes
Date sister - BM=yes

Ain't it cool?

<< BACK NEXT >>
Form Tutor
Lessons: Intro 1 2 3 4 5 6 7 8 9 10 11 12 13      Quick Forms Reference
HTML 4.0 Reference      Barebones HTML Guide