Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

A very simple HTML radio button question

Status
Not open for further replies.
Oct 22, 2001
28
GB
Hi,

I would like to collect information by giving the website user an 'either/or' option. I think I need to be using radio buttons to do this but what I've got so far doesn't seem to be working. The code is:

<form ACTION=&quot;Result.htm&quot; METHOD=&quot;POST&quot;> Home Use<input id=&quot;radHomeUse&quot; type=&quot;radio&quot; name=&quot;radHomeUse&quot;>    
Office Use<input id=&quot;radOfficeUs&quot; type=&quot;radio&quot; name=&quot;radOfficeUs&quot;>
<input id=&quot;btnSubmit&quot; type=&quot;submit&quot; name=&quot;btnSubmit&quot;>
</form>

and the problem I'm having is that I can click both the options at once - which is obviously not what i want to do. I've checked out quite a few HTML websites regarding this but can't see where I'm going wrong.

Any thoughts or advice would be greatly appreciated!
 
Give the two radio buttons ONE NAME and two different values. You might go like this:

Home user <input type=&quot;radio&quot; name=&quot;userchoice&quot; value=&quot;0&quot;>
Office user <input type=&quot;radio&quot; name=&quot;userchoice&quot; value=&quot;1&quot;>
....:::::.... xxLargeWASP ....:::::....
 
Thanks very much xxlargewasp!

That was exactly what I needed - it seems so easy when you know how...

I notice that you didn't include an ID attribute in your example, only a NAME - am I right in thinking that the ID attribute is being/has been depricated in current versions of HTML?

Once again, thanks very much for your help
 
actually, i'm a CF developer, but believe me i don't know what's the ID for! and i've never used it. but i guess the name and the value attributes are enough for now :) good luck dude ....:::::.... xxLargeWASP ....:::::....
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top