PHP Cookie code problem?

Nik

New member
I have a cookie that does store the persons name from an input form which the user enters their name and it uploads it to a cokie and then displays it.

My problem is the cookie is delayed in the sense that if you enter your name and the cookie is blank nothing happens then if you entered the word tank for example it would display your name then if you enter another word it would display tank. How do I stop this.

Secondly to clear the cookie by deleting browser history doesn't actually delete my cookie as
when I clear history as well as cookie history it does it I reload the web page and enter a name it still does the problem mentioned above if tank was the last name entered it displays that.
__________________________________________________________
Actual cookie

<?php
setcookie("name1", $_REQUEST['name'], time()+3600, "/","", 0);
?>
___________________________________________________________

To display cookie

<?php echo $_COOKIE ["name1"] ;?>
___________________________________________________________

I would appreciate any help here Thanks
 
Back
Top