Page 1 of 1

How Can I Hanlde With Cookie Here ?

Posted: Thu Dec 01, 2005 2:33 pm
by saqib389
i have create first page page "login.php" here is username and email

then after submiting form on 2nd page this show another feilds like 'name'.. 'age' location..

after sumbiting 2nd page then on third page there shuld come login.php values that

"Welcome to "USERNAME value"

and on 3rd page there would b a link of first page.... login.php... whenever i click on login.php again then ... i shuld not see the Text feilds........

it shuld come there like you have logged in ... welcome to "username value"

i hope you get my point

i m unable to do this
plz any one can help me ? as u ppl help me before
i will look forward to hear ur response

SaQib

Posted: Thu Dec 01, 2005 2:46 pm
by foobar
Code please. Otherwise it's really hard to help, honestly! :(

Posted: Fri Dec 02, 2005 2:08 am
by saqib389
here is the code

login.php

Code: Select all

<html>
<body>
<form action=cookie.php method=post>
Name:<input type=text name=username/><br>
Email:<input type=text name=email ><br>
<input type="submit" name="submit" value="Submit me!" />
</body>
</html>

cookie.php ---- ( here i m getting error )

Code: Select all

<?php
setcookie("uname",$_POST['username']);
?>
<html> 
<body> 
<form action = print.php method="post"> 
Name:<Br><input name="name" type="text" /><Br> 
Age:<Br><input name="age" type="text" /><Br> 
Location:<Br><input name="loc" type="text" /><Br> 
<input type="submit" name="submit" value="Submit me!" /> 
</form> 
</body> 
</html>

print.php

Code: Select all

<?php
echo "Hello, ".$_COOKIE['uname'];
?>
here i want to display that Hello "Username" Which i have enter on

first page. that username shuld store on cookies.... and when i

redirect the login.php.. that page should not ask me for username

again.. and login.php should display "hi username(sam)"

plz guide me how to do this..

SaQib