Validations in Php for a Checkbox

                   Validations in Php for Checkbox here why I am specifying the particular word because my friends ask me it is not possible as you given validation is not running if the more than 2 or 3 checkboxes are used in a form. Hence it is simple as I already tried when I am doing my assignments in html before I am learning the Php. Mean while the code as follows ,hopes it will helpful for you.



<script>

function validate_checkbox ( )

{

valid = true;

if ( document.f1.installment_1.checked == false && document.f1.installment_2.checked == false && document.f1.installment_3.checked == false && document.f1.installment_4.checked == false )

{

alert ( "Please check one of the term" );

valid = false;
}

return valid;
}
</script>

No comments: