Radio buttons.

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
gkwhitworth
Forum Commoner
Posts: 85
Joined: Tue Sep 05, 2006 8:28 pm
Location: Wasilla, Alaska

Radio buttons.

Post by gkwhitworth »

Ok, I have my form pretty much completed. I need for you to guys to help me out with radio buttons. My site is
http://www.gkwinspired.com/contact/web_new.php

Alright, the form works beautifally except for the radio buttons, they don't send information through. I did some searching through this forum and found that radio buttons are sent as arrays, but no actual help on how to pull this off.

--
Greg
Last edited by gkwhitworth on Sat Sep 16, 2006 12:20 am, edited 1 time in total.
User avatar
aaronhall
DevNet Resident
Posts: 1040
Joined: Tue Aug 13, 2002 5:10 pm
Location: Back in Phoenix, missing the microbrews
Contact:

Post by aaronhall »

You're site appears to be down, but check out http://www.echoecho.com/htmlforms10.htm -- make sure you're using the input tags correctly. The radio inputs are accessible to PHP as variables, not arrays. The selected radio button's value property is sent to PHP in a $_GET or $_POST entry with the key being the input's name property.

<input type="radio" name="groupOfButtons" value="foo"> Foo
<input type="radio" name="groupOfButtons" value="bar"> Bar

If "Bar" is selected, $_GET['groupOfButtons'] or $_POST['groupOfButtons'] (depending on your form's "method" property) will return "bar".
User avatar
gkwhitworth
Forum Commoner
Posts: 85
Joined: Tue Sep 05, 2006 8:28 pm
Location: Wasilla, Alaska

Post by gkwhitworth »

User avatar
aaronhall
DevNet Resident
Posts: 1040
Joined: Tue Aug 13, 2002 5:10 pm
Location: Back in Phoenix, missing the microbrews
Contact:

Post by aaronhall »

You'll want to use a checkbox for boolean options -- radio buttons are used to select one of a list. Check out http://www.globalissa.com/articles/articleCheckbox.php.
User avatar
gkwhitworth
Forum Commoner
Posts: 85
Joined: Tue Sep 05, 2006 8:28 pm
Location: Wasilla, Alaska

IT WORKS! Now on to the mail() function.

Post by gkwhitworth »

I changed them....it works now...thanks aaron.

--
Greg
User avatar
Luke
The Ninja Space Mod
Posts: 6424
Joined: Fri Aug 05, 2005 1:53 pm
Location: Paradise, CA

Post by Luke »

hey nice site design... very clean! one suggestion though... when you click on the main navigation buttons, that particular page name replaces "home" in the uhh active page thing on the left. I like that little feature... it's nice... but I would move the box to the pagename instead of moving the pagename to the box. It confuses people when links change position from page to page. Othat than that I really like your design!

this is what I mean

[/offtopic]
User avatar
gkwhitworth
Forum Commoner
Posts: 85
Joined: Tue Sep 05, 2006 8:28 pm
Location: Wasilla, Alaska

Thanks

Post by gkwhitworth »

Thanks....I knew what you were getting at....I hope that you didn't photoshop that too long. :) Anyways, I have been planning on redoing the template anyways for other reasons, but that was my first seamless CSS design....only 2 pictures total in the template.

--
Greg
Post Reply