So, I am creating a HTML 5 game and to create saves I want to store the save data in cookies. In trying to understand how this works I created a form app:
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<form action="cookieset.php" method="post">
<p> Astate <input type="text" name="astate" size="10px" /></p>
<p> Wstate <input type="text" name="wstate" size="10px" /></p>
<p> Cstate <input type="text" name="cstate" size="10px" /></p>
<p> Gstate <input type="text" name="gstate" size="10px" /></p>
<p> G2state <input type="text" name="g2state" size="10px" /></p>
<p> G3state <input type="text" name="g3state" size="10px" /></p>
<p> AKCstate <input type="text" name="akcstate" size="10px" /></p>
<p> TKCstate <input type="text" name="tkcstate" size="10px" /></p>
<p> FKCstate <input type="text" name="fkcstate" size="10px" /></p>
<input type="submit" name="submit" value="Submit" />
</form>
<form action="retreive.php" method="get">
<input type="submit" name="retreive" value="Retreive" />
</form>
</body>
</html
also, please forgive my noobness as I am sure it is just a stupid mistake or my lack of basic understanding of something, here is cookie set.php, the error handeling is working, I am just getting null for every value insted of the value I put into the form app:
<?php
$_POST['$astate'];
$_POST['$wstate'];
$_POST['$cstate'];
$_POST['$gstate'];
$_POST['$g2state'];
$_POST['$g3state'];
$_POST['$akcstate'];
$_POST['$tkcstate'];
$_POST['$fkcstate'];
setcookie("rqs1", $astate);
setcookie("rqs2", $wstate);
setcookie("rqs3", $cstate);
setcookie("rqs4", $gstate);
setcookie("rqs5", $g2state);
setcookie("rqs6", $g3state);
setcookie("rqs7", $akcstate);
setcookie("rqs8", $tkcstate);
setcookie("rqs9", $fkcstate);
if(isset($_COOKIE['rqs1'])){
echo "$name : $value <br />\n";
}
elseif(!(isset($_COOKIE['rqs1']))){
echo "null \n";
}
if(isset($_COOKIE['rqs2'])){
echo "$name : $value <br />\n";
}
elseif(!(isset($_COOKIE['rqs2']))){
echo "null \n";
}
if(isset($_COOKIE['rqs3'])){
echo "$name : $value <br />\n";
}
elseif(!(isset($_COOKIE['rqs3']))){
echo "null \n";
}
if(isset($_COOKIE['rqs4'])){
echo "$name : $value <br />\n";
}
elseif(!(isset($_COOKIE['rqs4']))){
echo "null \n";
}
if(isset($_COOKIE['rqs5'])){
echo "$name : $value <br />\n";
}
elseif(!(isset($_COOKIE['rqs5']))){
echo "null \n";
}
if(isset($_COOKIE['rqs6'])){
echo "$name : $value <br />\n";
}
elseif(!(isset($_COOKIE['rqs6']))){
echo "null \n";
}
if(isset($_COOKIE['rqs7'])){
echo "$name : $value <br />\n";
}
elseif(!(isset($_COOKIE['rqs7']))){
echo "null \n";
}
if(isset($_COOKIE['rqs8'])){
echo "$name : $value <br />\n";
}
elseif(!(isset($_COOKIE['rqs8']))){
echo "null \n";
}
if(isset($_COOKIE['rqs9'])){
echo "$name : $value <br />\n";
}
elseif(!(isset($_COOKIE['rqs9']))){
echo "null \n";
}
?>