This seems really simple but for whatever reason I can’t access a few radio button values in PHP. I have four radio buttons but the PHP is not grabbing the values. My HTML looks like this:
<form id="form69" name="form69" class="wufoo topLabel page" method="post" action="test.php">
<ul>
<li>
<span class="applied-before"> <label>Have you ever applied for a visa to the United States?</label>
<label for="has-applied-visa">Yes</label>
<input type="radio" value="yes" name="appliedfvisa" id="has-applied-visa" />
<label for="not-applied-visa">No</label>
<input type="radio" value="no" name="appliedfvisa" id="not-applied-visa" checked />
</span>
</li>
</ul>
</form>
When I try and grab the value in PHP it says the value is undefined.
<?php
if (isset($_POST['saveForm'])) {
$appliedvisa = $POST['appliedfvisa'];
echo '<div> TEST: ' . $appliedvisa . '</div>';
}
?>
When I use fidler to check what was submitted I get the correct values:
appliedfvisa=no&saveForm=Submit
But why can’t my PHP access them?? I am at a complete loss.
There’s a typo in your code:
should be:
I’d recommend always developing with error_reporting set to E_ALL at least, which would help you catch problems like this.