I'd like to have a TEXT link to POST a variable that could be registered with session and on another click of the same link change the var back to previous state.
Why I want to POST, because i do not want to append var to the URL. If there's a better way of doing (without going to another page -- I' m open to suggestions).
Currently I am confident I am overcomplicating this process. Feel free to cut the code as you wish.
Here's what i've got so far:
// 1. link
<a href='javascript:hidePub()'>hide details</a>
// 2. form to submit POST
<form name=pubFold method=post>
<input type=hidden name=pubDtls value='".$_SESSION["pub_details"]."'>
</form>
// 3. messed up logic
if (!isset($_POST["pubDtls"])) {
$_SESSION["pub_details"] = "y";
} else {
if ($_SESSION["pub_details"] != 'n') {
echo "<form name=pubFold method=post>
<input type=hidden name=pubDtls value='y'>
</form>";
$_SESSION["pub_details"] = $_POST["pubDtls"];
} else {
echo "<form name=pubFold method=post>
<input type=hidden name=pubDtls value='n'>
</form>";
$_SESSION["pub_details"] = $_POST["pubDtls"];
}
}
";