Checkbox Validation

It seems you’re confused on about how things work.

You cannot prohibit someone from pressing “submit” if checkbox isn’t checked only by using PHP.

You can do such things with Javascript. Also, it seems you are working with quite an old example, as it seems that register_globals=on is assumed.

Now, if you want to check whether the checkbox was checked within your php script upon submission, you do it like this:

<div class="checkmark">
<label for="check">Agree to Terms</label>
<input type="checkbox" id="check" name="check" value="yes"/>
<?php if(!isset($_POST['check'])){ ?>
<label for="check" class="error">You must agree to terms</label>
<?php } ?> <br />

</div>

You also had a mistake in naming your checkbox. Your code was:

<input type="checkbox" id="check" name"check" value="yes"/>

It should be:

<input type="checkbox" id="check" name="check" value="yes"/>

So try to pay attention to details :slight_smile: