Originally posted by EvoRacer
try this:
<input name="list" type="checkbox" value="<?php echo $ref_id; ?>" <?php if($_POST['list'] == $ref_id){echo "selected";}>
see if it works..
Thats not quite what Im looking for, Im gonna put more of the code up to try clarify
1: a little javascript to let me check/uncheck all the boxes at once
<!-- Begin
function checkAll(field)
{
for (i = 0; i < field.length; i++)
field.checked = true ;
}
function uncheckAll(field)
{
for (i = 0; i < field.length; i++)
field[i].checked = false ;
}
// End -->
</script>
2: call some info out of a database and assign a value for each checkbox
for($x=0;$x<$noofRows;$x++)
{
$ref_id= mysql_result($result,$x,'id');
echo '<input name=list type="checkbox"value="'.$ref_id.'">';
}
Call the Javascript to either check or uncheck all the boxes
<a href = "javascript:checkAll(document.myForm.list)">select all</a> / <a href = "javascript:uncheckAll(document.myForm.list)">unselect all</a></td>
This all works a treat, but how do i now capture the selected checkboxes when I submit the form?