- Code: Select all
<script type="text/javascript">
function checkIt(list)
{
if(list.checked == false)
{
for(var i = 0;i < list.length;i++)
{
list[i].checked = true;
}
}
else
{
for(var i = 0;i < list.length;i++)
{
list[i].checked = false;
}
}
}
</script>
And I call this script in below form...
- Code: Select all
<form action="delete.php" method="post" name="frm">
<table width="400" height="123" align="center" rules="rows">
<tr>
<th width="106"><div align="left"><input name="all" type="checkbox" id="all" onPropertyChange="checkIt(this.form.check);" />Select All
</div></th><th width="68"><div align="left">Name</div></th><th width="53"><div align="left">Age</div></th><th width="45"><div align="left">Sex</div></th><th width="104"><div align="left">Occupation</div></th>
</tr>
<?php
while($row=mysql_fetch_row($result))
{
?>
<tr>
<td><input type="checkbox" value="<?php echo $row[0];?>" name="check[]" /></td><td><?php echo $row[1];?></td><td><?php echo $row[2];?></td><td><?php echo $row[3];?></td><td><?php echo $row[4];?></td>
</tr>
<?php }?>
<tr>
<td colspan="5" align="center"><input type="submit" value="Delete" name="delete" /></td>
</tr>
</table>
</form>


