I have a form on a page with multiple checkboxes under one name. The value for them is an ID number.
the checkbox looks like this:
echo "<input type='checkbox' name='l_id[]' value='$row[0]'>";
There are also numerous tables with these checkboxes set up for each database in the system where the users are found with ID's.
At the bottom of the tables, there is a button to be clicked, that removes the users who are checked off from the system (logs them out).
The form and the button:
//top of form
echo "<form name='logout' method='GET' action='$PHP_SELF' onSubmit='return validate_logout(this)'>";
//bottom of form
echo "<input name='submit' type='submit' value='logout'></form>";
Ok... so this is the validation located in a seperate .inc file in Java Script
<script>
function validate_logout(form) {
var submitform = true;
var errors = "You have errors in the following fields: \n\n";
var l_id = eval ("document.forms[0].elements['l_id']");
if(l_id == "") {
submitform = false;
errors += "No Users Checked\n";
}
if (submitform == false) {
alert(errors);
return false;
}
}
</script>
Now I have tried different things. For instance I know chjecked and false have to be in there somewhere, but it wouldn't work.
Any ideas ?
Thanks.