I did once, if I remember once, this "strategy":
<input type="hidden" name="R_a" value="n">
<input type="checkbox" name="R_a" value="y" <?php echo $checked ?>>
If checked, you will have value "y". Though, if unchecked, or it was checked and visitor unchecked, the value should be "n".

;)

-afan


Ronald Wiplinger wrote:
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


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to