# In need of a Cookie

**URL:** <https://forum.kirupa.com/t/in-need-of-a-cookie/23882>\
**Category:** Uncategorized\
**Created:** [June 23, 2003, 8:57pm UTC](https://forum.kirupa.com/t/in-need-of-a-cookie/23882 "2003-06-23T20:57:13Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![titter](https://avatars.discourse-cdn.com/v4/letter/t/f0a364/32.png) [@titter](https://forum.kirupa.com/u/titter)\
**Post date:** [June 23, 2003, 8:57pm UTC](https://forum.kirupa.com/t/in-need-of-a-cookie/23882/1 "2003-06-23T20:57:13Z")

</div>

I am working on a new site, and I have already created 4 different color schemes for it, sorta like the forums here. I was wondering on how to create a cookie js to store the user selection, and then apply that code to a button in flash…:q:

[http://overrated.enervated.com/index.php?c=red](http://overrated.enervated.com/index.php?c=red)  
[http://overrated.enervated.com/index.php?c=blue](http://overrated.enervated.com/index.php?c=blue)  
[http://overrated.enervated.com/index.php?c=green](http://overrated.enervated.com/index.php?c=green)  
[http://overrated.enervated.com/index.php?c=orange](http://overrated.enervated.com/index.php?c=orange)

I created a string query with php to make this easier, but I am still having troubles…thanks in advance…

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [June 23, 2003, 9:03pm UTC](https://forum.kirupa.com/t/in-need-of-a-cookie/23882/2 "2003-06-23T21:03:42Z")

</div>

Does this help any?

[http://www.spoono.com/tutorials/php/cookies/](http://www.spoono.com/tutorials/php/cookies/)

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [June 23, 2003, 9:28pm UTC](https://forum.kirupa.com/t/in-need-of-a-cookie/23882/3 "2003-06-23T21:28:48Z")

</div>

I understand what Spoono is saying, but where would I set the cookie?

```php
<? 
$page = $_GET["c"]; 
if (($c == "red") or ($c == "")) { 
       include("index.html"); 
} else if($c == "blue") { 
       include("indexb.html"); 
} else if($c == "green") { 
       include("indexg.html"); 
} else if($c == "orange") { 
       include("indexo.html"); 
} 
?> 

```

This is all index.php consists of, any idea?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [June 23, 2003, 9:34pm UTC](https://forum.kirupa.com/t/in-need-of-a-cookie/23882/4 "2003-06-23T21:34:46Z")

</div>

Im not PHP expert man, I don’t know any PHP, but I am guessing you can create a function in PHP that will set a cookie depending on the value in the function parameter…

I don’t know PHP syntax, but I am going to take a shot…

```php
function applyCookie(cookieValue) {
setcookie ("cookie", cookieValue);
};

```

And then on your button you call the function like…

applyCookie(“blue”);

Or something like that. This is about as much as I can help you on this subject. Sorry.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [June 23, 2003, 9:46pm UTC](https://forum.kirupa.com/t/in-need-of-a-cookie/23882/5 "2003-06-23T21:46:50Z")

</div>

Alright man, thxs. I will work with and get it eventually 😃
