Help needed.I searched but failed to find solution.Here is my problem,
I have page contains list of data from database and checkbox for each row in the list. Going through pages using pagination, have to remember checkbox till the page submits for process.
On pagination there is no form , it just opens a new page.
What i have done is created a script to store checked data to an array . I want to pass that array with the link(pagination).
Here is the script
<script>
function sel_check(file_id,chk_id)
{
var lfckv = document.getElementById(chk_id).checked;
if(lfckv==true)
{
myCheckbox_array.push(file_id);
}
else
{
for(var i=0; i<myCheckbox_array.length;i++ )
{
if(myCheckbox_array[i]==file_id)
myCheckbox_array.splice(i,1);
}
}
}
</script>
and this is how pagination looks
<?php
$select_budget="SELECT bdg_id,name FROM tb_budget ";
$pager = new pager($select_budget,'num',$dispaly_rows,"&page=&view=list&bdg_id=$bdg_id&",$self_url);
$count=0;
while(list($bdg_id,$name)=$db->fetch_array($pager->result))
{
$count++;
<tr>
<td><input type="checkbox" name="ckbx_[<?php echo $count;?>]" id="ckbx_grant<?php echo $count;?>" onclick="sel_check(<?php echo $bdg_id;?>,'ckbx_<?php echo $count;?>')" /></td>
<td><?php echo $name; ?></td>
</tr>
}
echo $pager->show();
?>
<input type="submit" />