Saving address details (not credit card) into a cookie
Hiya,
My customer wants to avoid using customer logins on their website but wants to give the user the option to save their address details for next time. I've used the storing the login details tutorial to try and achieve this. So I obviously have the form fields and then a remember me checkbox.
Code for setting cookies is as follows:
<?php
if ((((isset($_POST["remember"]))?$_POST["remember"]:"") != "")) {
setcookie("remember", "1", time()+(60*60*24*60), "/", "", 0);
}
?>
<?php
if ((((isset($_POST["remember"]))?$_POST["remember"]:"") != "")) {
setcookie("firstname", "".((isset($_POST["firstname"]))?$_POST["firstname"]:"") ."", time()+(60*60*24*60), "/", "", 0);
}
?>
etc for each form field.
and the individual form fields look like this:
<input name="firstname" type="text" id="firstname" value="<?php echo((isset($_COOKIE["firstname"]))?$_COOKIE["firstname"]:"") ?>" size="40" />
and remember me button like this:
<input name="firstname" type="text" id="firstname" value="<?php echo((isset($_COOKIE["firstname"]))?$_COOKIE["firstname"]:"") ?>" size="40" />
However it doesn't seem to be working. Can you tell me what I might be doing wrong, or alternatively is there a better way of doing this?
Thanks.