Cookie or Session Variable not being passed
I had this problem a few months ago and Jason called me - then after about an hour of messing around, I think he got it to work by making the cookie name all Caps. He couldnt understand why but marked it as fixed.
I hadnt used the tool since then but now am having the same problem. I simply want to pass the first name field on a form to either a session variable OR a cookie so that on the next page it can say "Thank you, [FIRST_NAME]."
I tried both a cookie and a session variabler and neither passes to the next page.
I used:
<?php
if (!session_id()) session_start();
if($_SERVER["REQUEST_METHOD"] == "POST") {
$_SESSION["FIRST_NAME"] = "".((isset($_POST["firstname"]))?$_POST["firstname"]:"") ."";
}
?>
to set the Server Variable FIRST_NAME from the form field firstname.
What am I doing wrong? I can use the ecart behavior of setting a session variable without actually having a cart on the site, right?
On the following page I am using
<?php echo $_SESSION['FIRST_NAME']; ?>
to show the variable, but it is always blank. For the cookie I used the behavior as well as the server behavior - tried setting it in both places and name it FIRST but it didnt work either.
Any ideas?