How Can I Hanlde With Cookie Here ?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
saqib389
Forum Commoner
Posts: 44
Joined: Wed Nov 30, 2005 2:13 am

How Can I Hanlde With Cookie Here ?

Post 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
foobar
Forum Regular
Posts: 613
Joined: Wed Sep 28, 2005 10:08 am

Post by foobar »

Code please. Otherwise it's really hard to help, honestly! :(
saqib389
Forum Commoner
Posts: 44
Joined: Wed Nov 30, 2005 2:13 am

Post 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
Post Reply