The other answers here are correct: you have to do this on the client side. In the case of the check box, if the check box is not selected, there is no guarantee that the browser will include the POST parameter for this field.
For example, if you submit this form without checking the box:
<form action="test.php" method="post"> <input type="checkbox" name="checkbox" value="YES" /> <input type="submit" name="submit" value="submit" /> </form>
only the submit=submit parameter will be sent.
So no, you cannot guarantee that this flag exists in the form on the server side.
source share