Below I have dynamical generated radio buttons, the names($approve variable is the name) per radio button pairs are different(dynamically created names using looping). When I create two buttons, one is for if you click it, all the radio button with the label approve will be selected all, and the other button is for the disapprove label button that will select the radio button with the label disapprove. How can I make this right. Below are the codes I created. Thanks
[CODE]
<script>
function selectAll()
{
var i = 0;
objElems = document.t4.elements;
for(i=0;i<objElems.length;i++){
objElems[i].checked =true;
}
</script>
[code=php]
<form action=”viewall.php” method=”post” name=”t4″>
while(condition)
{
echo “<td ><input type=’radio’ name='”. $approve.”‘ id=’app’ value=’approve’ /> Approve<br /> </td>
<td ><input type=’radio’ name='”. $approve.”‘ id=’disp’ value=’disapprove’ /> Disapprove<br /> </td> “;
}
<tr><td><input type=”button” name=”all_app” value=”Select All Approve” onclick=”selectAll(this.value);” ></td>
<td><input type=”button” name=”all_app2″ value=”Select All disapprove” onclick=”selectAll(this.value);” ></td>
</tr>
</form>