note 106976 deleted from function.setcookie by tularis
| From: | tularis@php.net | Date: | Thu, 22 Dec 2011 20:46:45 +0000 |
| Subject: | note 106976 deleted from function.setcookie by tularis | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-185227@lists.php.net to get a copy of this message | ||
Note Submitter: h0mayun at yahoo dot com
Reason: spam
----
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
}
?>