2012-08-19, 08:32 PM
I have made a radio button but I cannot get it to validate when a post is made.
Basically a user has to check the radio button, if they do not then an error message is presented - but it does not work the reply continues to post as normal.
How can I make this button so that it has to be checked in order for the user to post successfully?
PHP
HTML
Basically a user has to check the radio button, if they do not then an error message is presented - but it does not work the reply continues to post as normal.
How can I make this button so that it has to be checked in order for the user to post successfully?
PHP
<?php
$answer = $_POST['ans'];
if ($answer == "Not a Spammer") {
echo 'Correct';
}
else {
echo 'Incorrect';
}
?>
HTML
<form action="spambutton.php" method="post">
Answer 1 <input type="radio" name="ans" value="Not a Spammer" /><br />
<input type="submit" value="submit" />
</form>