Update database value from value select from radiobutton.

I want to do the Update database value from value select from radiobutton.
suppose, I have three radio buttons:Green
Black
White
when i want to update the database from value selected from radiobutton. how to do it?.
normal update query for updating database from textbox is written as following.
but we want to update the database from radiobutton.
mysql_query("UPDATE emp SET FirstName=’$_POST[nm1]’,LastName=’$_POST[nm2]’

[php]
$selected_radio = $_POST[‘color’];
[/php]

that will get you the selected radio in PHP now you just include it in your query

if you want to retrieve the last time stored radio from the database

[php]
$row = mysql_fetch_assoc($result);
?>

<input type=“radio” name=“color” value=“red” <?php if ($row['color'] == "red"){echo "checked";} ;?>/>Red
<input type=“radio” name=“color” value=“Green” <?php if ($row['color'] == "Green"){echo "checked";} ;?>/>Green
<input type=“radio” name=“color” value=“Black” <?php if ($row['color'] == "Black"){echo "checked";} ;?>/>Black
<input type=“radio” name=“color” value=“White” <?php if ($row['color'] == "white"){echo "checked";} ;?> />White
[/php]

Sponsor our Newsletter | Privacy Policy | Terms of Service