Radio buttons anf IF statements

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

On a form, i have
 <label><input name="radiogroup" type="radio" value="Technical">
        <label><input name="radiogroup" type="radio" value="Admin">
        <label><input name="radiogroup" type="radio" value="Site">
        <label><input name="radiogroup" type="radio" value="General"

then on another form i want an if statement
if ($radiogroup=="Admin")
$contact="email address";

Is this correct, or how do i do an if statement including depending on what
radio button is checked?

Kathryn (Fire Juggler)

Re: Radio buttons anf IF statements

*** Fire Juggler wrote/escribió (Tue, 22 Mar 2005 14:47:55 -0000):
Quoted text here. Click to load it

It's not portable since you're assuming that form variables will be
imported as local variables. which is often not the case. Also, a switch
normally provides clearer code in situations like this.


switch($_POST['radiogroup']){ // Use $_GET if method="get"
    case 'Admin':
    case 'Site':
    case 'General':



-- Álvaro G. Vicario - Burgos, Spain
-- Don't e-mail me your questions, post them to the group

Site Timeline