Jump to content

How to use a radio button in php


Blekk

Recommended Posts

Hi,

In my form, the user is logged in, there is a "send to email address?" checkbox, if checked it sends to their email...obviously (the email address is in the users record in the database). But now I want to make this selection into two Radio Buttons, one for "send to email address?" and "send to different email address?" with a textbox underneath.

What I would like to know is how to retrieve data from two radio buttons say $radio1 and $radio2, I tried the checkbox way of:

[code]if(isset($_POST['radio1']));
{
print "radio1 was selected";
}

if(isset($_POST['radio2']));
{
print "radio2 was selected";
}[/code]

But this meant that I could select both radio buttons at the same time, not what I am looking for.

Is it something like a select box? So that two options cant be chosen twice?

like:

[code]<select name="select">
<object value="hello">Hello</object>
<object value="goodbye">Goodbye</object>
</select>[/code]

Thanks,

Any reply is appreciated.
Link to comment
https://forums.phpfreaks.com/topic/30050-how-to-use-a-radio-button-in-php/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.