Firstly, I am starting a new thread because I would like to get some new eyes on this problem. I have another thread going, but it is getting long, drawn out and hard to read. With that said, here is my problem:
When I try to set a cookie with this code:
[code=php]setcookie (“please”, “work”);
It works. I get the cookie named please, with a value of work.
When I try to set a cookie with this code:
[code=php]$working = ‘work’;
setcookie (“please”, “$working”);
It works. I get the cookie named please, with a value of work.
When I try to set a cookie with this code:
[code=php]$email = $_POST[’email’];
setcookie (“please”, “$email”);
It doesn’t work. No cookie is even written.
when I echo $_POST[’email’] I get the email address I entered in the previous form.
The ONLY difference I see is that I have a quote around ‘work’ and no quote around $_POST[’email’].
So, I did this:
[code=php]$email = “$_POST[’email’]”;
setcookie (“please”, “$email”);
Notice the quotes around $_POST[’email’]. When I did that, I got this error returned:
[QUOTE]
Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/content/t/r/e/trevzilla/html/getfile.php on line 4
So, for giggles, I changed the single/double quotes around to this:
[code=php]$email = ‘$_POST[“email”]’;
setcookie (“please”, “$email”);
And I finally got a cookie to write. But guess what the value is! It sure isn’t an email address! The Value of the cookie came out to be this:
[QUOTE]
%24_POST%5B%22email%22%5D
So, with that long drawn out explanation, does anyone know what is going on here? Why isn’t a cookie writing with the email address in the value?