Checkall how to ???

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
pryn
Forum Newbie
Posts: 2
Joined: Wed Jul 10, 2002 8:09 am
Location: bk

Checkall how to ???

Post by pryn »

Could anyone help me,please.
I need a code to build checkall retrieve data from mysql .
jason
Site Admin
Posts: 1767
Joined: Thu Apr 18, 2002 3:14 pm
Location: Montreal, CA
Contact:

Post by jason »

Hrm? What do you mean?
pryn
Forum Newbie
Posts: 2
Joined: Wed Jul 10, 2002 8:09 am
Location: bk

Post 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 \" >";


?>
Post Reply