Page 1 of 1
I cannot understand this. Plz help!
Posted: Mon Mar 01, 2004 12:23 pm
by Joe
I have been doing some expeimentation with cookies lately and I have came to a huge hault with the subject. When I try to create a small cookie showing the username from the previous page it doesn't show when I check my cookies through javascript in the URL.
<?php
$username1 = $_POST['username'];
setcookie("username", $username1, time()+36000);
?>
Is the post method way out here or am I doing something else wrong here.
Regards
Joe

Posted: Mon Mar 01, 2004 12:25 pm
by toms100
can you please post how you are showing the cookie.
im not sure what you mean by "I check my cookies through javascript in the URL.", please elaborate.
...
Posted: Mon Mar 01, 2004 12:28 pm
by Joe
I mean by typing, javascript:alert(document.cookie); in the URL to view the cookie. Sorry for not explaining it the first time but i thought you would have known. So is there any chance of a little help on this?
Regards
Joe

Posted: Mon Mar 01, 2004 12:31 pm
by toms100
try this:
Code: Select all
<?php
setcookie("username", "bobmando", time()+36000);
?>
one less error factor to worry about!
no!
Posted: Mon Mar 01, 2004 12:34 pm
by Joe
Ya but that only uses the one username. I want to make it so im posting the username from one form to another if you know what i mean!
Regards
Joe

Posted: Mon Mar 01, 2004 12:52 pm
by toms100
yes, but does that work?
if it does, then your problem lies not with the cookie, but with the form submission!