OK, thought this was about the right time to show what I'm doing and how 😉
I output a list with checkboxes next to title line:
echo "<form method=post action='PAGE_with_DETAILED_RESULTS'>";
.....
foreach ($Items as $i)
{
echo "<tr>
<td><input type=checkbox name=tID[".$i->id."] value=".$i->id."></td>
<td>".$i->title."</td>
</tr>";
}
echo "<input type=submit name=selectItems value='View Selected'>";
// -->>> paging
if ($total > $limit) {
if ($page != 1) // this is the first page - there is no previous page
echo "<a href='thisPAGE&page=".($page - 1)."'>previous</a> |";
for ($i = 1; $i <= $pager->numPages; $i++) {
if ($i == $pager->page)
if ($i == $pager->numPages) {
echo " $i";
} else {
echo " $i |";
}
else
echo " <a href='thisPAGE&page=$i'>$i</a>";
}
if ($page != $pager->numPages) // this is the last page - there is no next page
echo " <a href='thisPAGE&page=".($page + 1)."'>next</a>";
}
// <<<-- paging
Once I submit selected checkboxes I get them in a loop:
if ($_POST['tID']) {
$ser_tID = serialize($tID);
}
if (!get_magic_quotes_gpc()) {
foreach($unser_tID as $key => $value) {
${$key} = addslashes($value);
}
} else {
foreach($unser_tID as $key => $value) {
${$key} = addslashes($value);
}
}
$in =array();
foreach ($unser_tID as $box) $in[] = $box;
$in = implode(',', $in);
$query = "SELECT ... IN ( $in )";
$details = $db->get_results($query);
foreach ($details as $det)
{
...detailed output...
}
Everything works great as long as I select checkboxes and submit. The problem is with page breaks. I do not really submit the page when I progress from screen to screen. I need to SOMEHOW be able to store selected values while I go from screen to screen and then submit it all together.
That's where I get stuck. I've attempted at using Javascript, but then changed my mind. I do set session_start() at the top of the page for other purposes. Can I assign selected vars to session, and if yes, then how?