How to submit a form on a radio button click?
I use a php page to presents the user with two options. The person clicks one of the options and then clicks the Submit button. Upon clicking the Submit button, the value of the clicked radio button is posted on an the corresponding action page.
Instead what I'd like is when the person clicks on the radio button group, its value is posted on the corresponding action page without the user having to click the Submit button.
Here is the current code for the simple two radio button form. The user can click Indoors or Outdoors.
<form action="outdoorfaucet.php" method="post" name="form1" id="form1">
<p>
<input type="radio" name="selectedfaucet" id="radio" value="outdoor">
<label for="radio">Outdoor</label>
</p>
<p>
<input type="radio" name="selectedfaucet" id="" value="indoors">
<label for="radio2">Indoors</label>
</p>
<p>
<input type="submit" name="submit" id="submit" value="Submit">
</p>
</form>
And here is the post statement on the corresponding action page as it is now.
<?php
// echo the values from the select facet page
echo "You have selected " . $_POST['selectedfaucet']. "<br";
?>
Can somebody help me modify this code so that the radio button's value is submitted, or posted, or otherwise sent to the action page? I'm new at this. Thanks in advance.
