I have a PHP page with simple script to "Check All" the checkboxes of the page.
I have to include a header.php in my code, and that is the area of problem.
When i don't include it, the code works fine. But when i include it code does not work, means CHECK ALL button does not selects all checkboxes.
My code is --
checkall.php
<html>
<body>
<script language="JavaScript">
function toggle(source) {
checkboxes = document.getElementsByName('foo');
for(var i=0, n=checkboxes.length;i<n;i++) {
checkboxes[i].checked = source.checked;
}
}
</script>
<?php include('header.php'); ?>
<input type="checkbox" onClick="toggle(this)" /> Toggle All<br/>
<input type="checkbox" name="foo" value="bar1"> Bar 1<br/>
<input type="checkbox" name="foo" value="bar2"> Bar 2<br/>
<input type="checkbox" name="foo" value="bar3"> Bar 3<br/>
<input type="checkbox" name="foo" value="bar4"> Bar 4<br/>
<?php include('footer.php'); ?>
</body>
</html>
I have tried all suggestions By Can Berk Güder
in this Question.
Any Suggestions...???