Hi,
I have this js code works perfectly in checking and un-checking the checkboxes.
[code=html]<html>
<HEAD>
<script type=”text/javascript”>
<!–
function checkAll(checkname, exby) {
for (i = 0; i < checkname.length; i++)
checkname[i].checked = exby.checked? true:false
}
// –>
</script>
</HEAD>
<BODY>
<form name =”mylist”>
<input type=”checkbox” name=”checkGroup” value =”first”>First<br>
<input type=”checkbox” name=”checkGroup” value =”second”>Second<br>
<input type=”checkbox” name=”checkGroup” value =”third”>Third<br>
<input type=”checkbox” name=”checkGroup” value =”fourth”>Fourth<br>
<input type=”checkbox” name=”all” onClick=”checkAll(document.mylist.checkGroup,this)”>Check/Uncheck All<br>
</form>
</body>
</html>
But i’m having problem in implementing it in my php code.
Because in my php i have my checkbox form variable is in array form
like this: multi_delete[]
so, how can make this script work ?
this is the php code
[code=php]
<form name =”mylist”>
<?php
//query here
while ($row = mysql_fetch_array($query)) {
$id = $row[‘id’];
echo “<input type=checkbox class=inputbordr name=’multi_delete[]’ value=’$id’><br>”;
}
echo “<input type=”checkbox” name=”all” onClick=”checkAll(document.mylist.multi_delete,this)”>Check/Uncheck All<br> “;
?>
</form>
Thanks in advance