views:

60

answers:

2

I have an html form consisting of just radio buttons. The 2nd line of the following is in a loop, therefore assume there are multiple radio buttons. The value of each radio button printed out is a PHP variable.

<form action='delFile.php' method='post'>
<input type='radio' value=" . $row['fileName'] . " name='del' />
<input type='submit' value='Delete' /></form>

My question is: How can I, on the action page, call the selected radio. I would normally use:

$foo = $_POST['valueHere'];

...but I don't know the value.

Maybe this isn't even possible? I want to know the fileName from the radio so that I can delete a row in a MySQL database on the action page. If I'm going about this the wrong way completely then please point me in the right direction :)

Any help is appreciated - Thanks in advance.

+1  A: 

The POST variables check the name of the fields, not the value. So, this will give you the value of whichever radio button was selected:

$foo = $_POST['del'];
Shawn Steward
Oh wow! I would have never thought to try the name.I was also worried my question didn't make any sense...Thank you! :)
HelloWorld
No problem. Glad to help.
Shawn Steward
A: 

$foo = $_POST['del'];

jax