note 20321 added to function.setcookie
| From: | php-general at lists dot php dot net | Date: | Sat, 30 Mar 2002 01:41:21 +0000 |
| Subject: | note 20321 added to function.setcookie | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-28398@lists.php.net to get a copy of this message | ||
This code adds a user name to your page. It will display "Welcome back username" every
time that user returns to your site using the same computer.
Code
<?php
if (0 != count($user2)){
echo("<html><body><a>Welcome Back $user2");
}
elseif (isset($name) and $name != "") {
$rated = $name;
setcookie(user2, $rated);
echo("<html><body><a>Hello $rated");
}
?>
<form action='test.php' method=post name=message>
<table>
<tr>
<td colspan ="2">
<input type="text" size="40" value="" name =name
maxlength=50>
</td>
<tr>
<td>
<input type=submit value='Submit' name='submit'
onclick='call_user_func('test','$name)'>
<td>
<input type='reset' value='Clear'>
</td>
</tr>
</table>
</body>
</html>
--
http://www.php.net/manual/en/function.setcookie.php
http://master.php.net/manage/user-notes.php?action=edit+20321
http://master.php.net/manage/user-notes.php?action=delete+20321
http://master.php.net/manage/user-notes.php?action=reject+20321