# PHP setcookie() ...vars arent working for values?

**URL:** <https://forum.kirupa.com/t/php-setcookie-vars-arent-working-for-values/186024>\
**Category:** programming\
**Created:** [April 18, 2006, 2:35pm UTC](https://forum.kirupa.com/t/php-setcookie-vars-arent-working-for-values/186024 "2006-04-18T14:35:40Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Zaid\_W1red](https://avatars.discourse-cdn.com/v4/letter/z/cab0a1/32.png) [@Zaid\_W1red](https://forum.kirupa.com/u/Zaid_W1red)\
**Post date:** [April 18, 2006, 2:35pm UTC](https://forum.kirupa.com/t/php-setcookie-vars-arent-working-for-values/186024/1 "2006-04-18T14:35:40Z")

</div>

Hey guys im trying to use this code:

```php

$cookTime = time()+60*60*24*100; 
$name = $_SESSION['poster'];
$pword = $_SESSION['pword'];
setcookie('nineiron', $name.'|'.$pword.'|'.$cookTime, 0, '/', 'nineironmusic.co.uk', 0);

```

…to set a cookie but the cookie is being written with out the vars.

I can echo the vars $name and $pword out into the document put they arent being written to the cookie…any ideas?

Zaid
