I'm trying to run the following code:
if($thisIsSaved > 0 && $_SESSION["loggedIn"] == 1)
{
//show unsave
echo "<script>$('#unsave').show();$('#save').hide();</script>";
}
elseif($thisIsSaved == 0 && $_SESSION["loggedIn"] == 1)
{
//show save
echo "<script>$('#save').show();$('#unsave').hide();</script>";
}
else
{
echo "<script>$('#unsave').hide();$('#save').hide();</script>";
}
<button id="save">Save</button>
<button id="unsave">Unsave</button>
I used to have this in pure PHP, no jQuery. What it did was, depending on the value of $thisIsSaved, it would display or not display either or both of the buttons. Now it's jQuery, and the page doesn't hold your save-state with jQuery as it can with PHP, so I have to find an alternate way of displaying and hiding the buttons in the beginning. Any help?