I will describe the task.
I have 2 links, the first link should show in dropdown menu "deyis" data and second link should show in dropdown menu "plomb" data.
First link PHP file code:
<?php
$token = trim($_REQUEST["Token"]);
if($tokenData = defineToken($token))
{
$token=str_replace("==","%3d%3d",$token);
$token=str_replace("+","%2b",$token);
$url_t = "MYLINK";
$p=1;
echo "<form action=\"$url_t\" method=\"POST\" id=\"storyForm\">";
echo "<input type=\"hidden\" name=\"deyis\" id=\"deyis\" value=$p>";
?>
</form>
<script>
document.getElementById("storyForm").submit();
</script>
And Second link is same, but sends value=2.
In my Index.php file I am getting data by POST
$s=$_POST['plomb'];
if($s==2)
{
echo "equal to 2";
}
$br=$_POST['deyis'];
if($br==1)
{
echo "equal to 1";
}
but after I press in same page button which shows data of anything it shows me that "Notice: Undefined index: plomb" and "Notice: Undefined index: deyis".
Thank you for your attention.
You can use local storage also which will pass your data and will save also without session.
like you want to store something do
localStorage.setItem("lastname", "Smith");
and when you want it back
localStorage.getItem("lastname", "Smith");
and you can remove it after if you want.
just check browser support before use. here:http://www.w3schools.com/html/html5_webstorage.asp