I have a link that when clicked POST hidden value, which needs to be set in SESSION. When clicked again needs to set another SESSION variable.
I am probably overcomplicating. I use a bit of JS to POST hidden field in order to hide it and not to append it to the URL. If there's a better way of doing it, I'd be ahppy to learn.
Here's what I have:
//js to submit form as POST
<script>
function hidePub() {
document.pubFold.submit();
}
</script>
<?
// messed up logic
if ($pubDtls != "n") {
$hideLnk = "hide";
echo "<form name=pubFold method=post>
<input type=hidden name=pubDtls value=n>
</form>";
} else {
$hideLnk = "show";
echo "<form name=pubFold method=post>
<input type=hidden name=pubDtls value=y>
</form>";
}
$pubDtls = $_POST["pubDtls"];
$_SESSION["pub_details"] = $pubDtls;
//link
<a href='javascript:hidePub()' >".$hideLnk."</a>
?>