I'm trying to have a feature so that members can show and hide items 'on-the-fly' by clicking a simple link which will change a value in a field for the session.
i set whether to show or not by altering this field so true or false for whether it should be hidden...
$_SESSION["hidden"] = false;
And for the actual code in the page I have this...
if($_SESSION[golduser] AND !$_SESSION[hidden]) {
for ($i = 1; $i <= $db->getField(numofitems); $i++) {
$row_color2 = ($row_count2 % 2) ? $color3 : $color4;
echo "<div style=\"background: ".$row_color2.";\">Item {$i}</div>";
$row_count2++;
}
}
if I manually set hidden in the file and refresh it works perfectly but can anyone suggest a better way to change the value without sending the value and using Header(Location: blabla.php) to reload the page? Or is that my best option?