note 106976 added to function.setcookie
| From: | h0mayun at yahoo dot com | Date: | Thu, 22 Dec 2011 13:59:32 +0000 |
| Subject: | note 106976 added to function.setcookie | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-185206@lists.php.net to get a copy of this message | ||
Cool Example To SET Background Color With Coockie
<?php
if (isset($_COOKIE["bg"]))
{
echo '<div
style="background-color:'.$_COOKIE["bg"].'">WORKED</div>';
echo 'background-color has been set to: <font
color="'.$_COOKIE["bg"].'">'.$_COOKIE["bg"].'</font>';
}else
{
setcookie("bg", $_POST['bgcolor'], time()+10);
?>
<br /><br />
background-color is not set
<br /><br />
Choose it:
<form method="post" >
<select name="bgcolor">
<option value="red">red</option>
<option value="blue">blue</option>
<option value="green">green</option>
<option value="yellow">yellow</option>
</select>
<input type="submit" />
<br /><br /><br />
REFRESH PAGE AFTER SUBMITING
</form>
<?php
}
?>
----
Server IP: 69.147.83.197
Probable Submitter: 91.200.233.133
----
Manual Page -- http://www.php.net/manual/en/function.setcookie.php
Edit -- https://master.php.net/note/edit/106976
Del: integrated -- https://master.php.net/note/delete/106976/integrated
Del: useless -- https://master.php.net/note/delete/106976/useless
Del: bad code -- https://master.php.net/note/delete/106976/bad+code
Del: spam -- https://master.php.net/note/delete/106976/spam
Del: non-english -- https://master.php.net/note/delete/106976/non-english
Del: in docs -- https://master.php.net/note/delete/106976/in+docs
Del: other reasons-- https://master.php.net/note/delete/106976
Reject -- https://master.php.net/note/reject/106976
Search -- https://master.php.net/manage/user-notes.php