Getting the value a user selected from a list of radio buttons
Posted on 2008-10-02
Hi everyone i hope you are all well.
Guys i have 2 php files.
<form name="input" action="processing.php" method="post">
<input type="radio" name="sex" value="male"> Male
<input type="radio" name="sex" value="female"> Female
<input type="submit" value="Submit">
This is a really simple example, but i have another scenario im currently working on that is having trouble receiving the correct value a user selected from a list of radio buttons. In that example, it is always getting the value of the LAST sql record returned, so im obviously doing something wrong there.
What id like to know is what is the CORRECT way to get the value of the radio button selected in processing.php?
I know in processing.php, I could do the following:
$getradiobuttonselected = $_POST['name'],
but i have tried this on my other "scenario" and it always gets the wrong value.
Any help greatly appreciated.