checkbox unchecked

From: Date: Sun, 02 Dec 2007 17:46:44 +0000
Subject: checkbox unchecked
Groups: php.general 
Request: Send a blank email to php-general+get-265381@lists.php.net to get a copy of this message
I have now tried to add many of the security hints on a web page and come to a problem. I am checking if the allowed fields match the sent fields. From the database I get the information if a checkbox is checked or not: <?php if($DB_a =="y") { $checked="checked"; } else { $checked=""; } ?> <input type="checkbox" name="R_a" value="y" <?php echo $checked ?> If the user takes out the checkmark the value will become "" and the field will not submitted which results in a missing field. $allowed = array(); $allowed[]='form'; $allowed[]='R_a'; $allowed[]='R_b'; .... $sent = $array_keys($_POST); if($allowed == $sent) { ... do some checking ... } else { echo "Expected input fields do not match!"; } break; How can I force a "n" for not checked in the input field? or how can I solve that? bye Ronald

« previous php.general (#265381) next »