This is the first time I've tried to use PHP cookies so I'm stuck and don't have any idea what the problem is
I have tried to set a cookie on the following page:
www.formymobile.co.uk/test2100fascias.shtml
The code looks like this:
<?php
setcookie("fasciaoffer", $name, time()+36000);
?>
<html>
I have checked & this does set a cookie on my pc
I then want to retrieve the cookie when my customer views their shopping basket and display a message
The code in my shopping basket is:
<?php
if (isset($_COOKIE["fasciaoffer"]))
echo "<b>Special offers available</b> - buy any 3 covers & get your 4th choice free! " . $_COOKIE["fasciaoffer"] . "!<br />";
else
echo "<b>Special offers available</b> - none available on current order<br />";
?>
The problem is as follows - even though I have the cookie on my pc, the message that comes up in my shopping basket is the one where the cookie has not be found
Anybody have any ideas about what the problem could be? Is my coding correct?
Also, I don't know if this makes any difference, but the file which the retrieve bit is in (the shopping basket) is not in the root folder
Thanks
Robert