Forum Moderators: mack

Message Too Old, No Replies

HTML Forms

Controls Question

         

madcat

3:07 pm on Oct 2, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



My apologies if this has been discussed a bit:

I've got the Form tutorial from WW open and I'm picking through it. I have a couple of questions though- things don't seem to be working correctly.

a. When I use ID instead of name as the <input> attribute- I get nothing back from my form results...name works fine.

b. When I set-up checkboxes- should the boxes that aren't checked appear labeled 'off' in the results? I only get 'on'. If it is not checked there is a blank space in the results.

c. When using radio buttons- should the control name be something like- name="level" or name="level[]"? When using the latter and submitting it to a PHP script it of course will produce 'array'-> Any clarification on this or any of these is appreciated.

Thanks in advance.

aspdaddy

3:34 pm on Oct 2, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Madcat,

a-As a general rule its best to use name and id on an input.

b-No, only the checked boxes give you a value. you can get a list if you give them all the same name - on,,on,,on,,,,,,,etc
and then use a split function -
ArrayOfCheckboxes = split(request("myCheckBoxes"),",")

c-if you want them grouped ( so only one can be on) give them identical names, different values

hope it helps
aspdaddy