I'm trying to create a simple PHP checkbox validator for my boss's website but my PHP code doesn't work. I've jimmied some basic checkbox code I found on the net, and tried working with an "if" statement but I get the same result whether I check the box or not.
Ideally I'd like to set it up where you have to check the box to prove you're not a spambot, not uncheck it. I'll settle for either solution though. How do I fix my code?
Live form: http://agentboris.com/listings/test-form.php
HTML:
<input type="checkbox" id="spambot" name="spambot" value="Yes" checked>
<label for='spambot'><span class="parastyle grey">Uncheck box to show you are not a Spambot.</span></label><br><br />
PHP (condensed):
$spambot = $_POST['spambot'];
if ($spambot != 'Yes') {
$spambot = 'No';
}
if($spambot = 'Yes')
{
echo "Please go back and uncheck the Spambot box.";
exit;
}