Page 1 of 1

Checkall how to ???

Posted: Wed Jul 10, 2002 8:09 am
by pryn
Could anyone help me,please.
I need a code to build checkall retrieve data from mysql .

Posted: Wed Jul 10, 2002 12:15 pm
by jason
Hrm? What do you mean?

Posted: Sat Jul 13, 2002 6:45 am
by pryn
I found the answer. Its here.

<script language="Javascript">

function toggleAll(toggleBox) {
var currForm = toggleBox.form;
var isChecked = toggleBox.checked;
for (var elementIdx=0; elementIdx<currForm.elements.length; elementIdx++) {
if (currForm.elements[elementIdx].type == 'checkbox') {
currForm.elements[elementIdx].checked = isChecked;
}
}
}

</script>

<?
echo"<form name=tt_id action=\"result.php\" method=post>";
$count=0;
while($myrow=MySQL_fetch_array($result))
{
$tt_id=$myrow["key"];
echo"<input type=checkbox name=tt_id[$count] value='$tt_id'>$myrow[key]";
$count++;
}

echo"<input type=\"checkbox\" name=\"tt_id[$count] \" onclick=\"toggleAll(this)\">select / deselect all ";

echo"<input type=\"submit\" value=\" Send Now \" >";


?>