Page 1 of 1

Radio buttons & $_POST

Posted: Sun Mar 29, 2009 4:37 pm
by xNuManx
Hello, I am trying to get this code to work, but its not. here's what i have:

Code: Select all

        <input type="radio" name="genre" value="Reggaeton">Reggaeton<br>
        <input type="radio" name="genre" value="Merengue">Merengue<br>
        <input type="radio" name="genre" value="DominicanHipHop">Dominican Hip-Hop<br>
        <input type="radio" name="genre" value="Rap">Rap<br>
        <input type="radio" name="genre" value="Rock">Rock<br>
 
And my $_POST:

Code: Select all

if($_POST['genre'] == "Reggaeton") {
$chlist = 1;
 } elseif($_POST['genre'] == "Merengue") {
$chlist = 2; 
} elseif($_POST['genre'] == "DominicanHipHop") {
$chlist = 3; 
} elseif($_POST['genre'] == "Rap") {
$chlist = 4; 
} elseif($_POST['genre'] == "Rock") {
$chlist = 5; 
}
But my $_POST is not working, Any help please!

Re: Radio buttons & $_POST

Posted: Sun Mar 29, 2009 5:12 pm
by requinix

Code: Select all

print_r($_POST);
Make sure the genre shows up in there. Sure you're using POST and not GET?

Re: Radio buttons & $_POST

Posted: Sun Mar 29, 2009 5:45 pm
by xNuManx
tasairis wrote:

Code: Select all

print_r($_POST);
Make sure the genre shows up in there. Sure you're using POST and not GET?
Yeah i am using post, and genre does comes out there:
[genre] => Reggaeton

Re: Radio buttons & $_POST

Posted: Sun Mar 29, 2009 7:04 pm
by requinix
So how do you know it's not working? Have you checked $chlist to see if that's right?