Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => General

radio buttons

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

radio buttons

Postby uncertain_manos » Fri Nov 01, 2002 8:01 am

hi there,
I have made up a form and I want to send via e-mail the input. The problem is that although I know that for the text I only need to write $textname, I don't know how I have to handle the radio button. I wrote in PHP $radioButtonName but it returns empty.
Can you please help me?
thanks in advance,
Manos
uncertain_manos
New php-forum User
New php-forum User
 
Posts: 31
Joined: Wed Oct 23, 2002 12:55 am

Postby DoppyNL » Fri Nov 01, 2002 8:27 am

When none of the radio buttons are selected the browser will not return any info about that radio-button. Same with check-boxes.
To make sure that one option is allways selected you can add "checked" to one of the radio-buttons tags. That button will than be selected by default.

Greetz Daan
DoppyNL
 

Re: radio buttons

Postby uncertain_manos » Fri Nov 01, 2002 8:41 am

ok then
my interest is to get input from the user if he checkes a radio or checkbox (preferably checkbox). How can I get the information that the checkbox has been checked?
thanks,
Manos
uncertain_manos
New php-forum User
New php-forum User
 
Posts: 31
Joined: Wed Oct 23, 2002 12:55 am

Postby DoppyNL » Fri Nov 01, 2002 8:44 am

If a checkbox has been checked it is set in your script
you can use
Code: Select all
isset($_POST['name_of_variable']);
to determine if the checkbox was checked or not.
If a checkbox wasn't checked, it's not available in your script, because the browser won't send any data about that checkbox back to the server in that case.

Greetz Daan
DoppyNL
 

Postby uncertain_manos » Fri Nov 01, 2002 9:35 am

thank you. I finally did it

regards,
Manos
uncertain_manos
New php-forum User
New php-forum User
 
Posts: 31
Joined: Wed Oct 23, 2002 12:55 am


Return to PHP coding => General

Who is online

Users browsing this forum: Bing [Bot] and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.

cron