Jump to content

Variable value in cookie


habook2

Recommended Posts

I need to put the value of a variable in a cookie. I think it's:

[code] setcookie ("cookiename", '$variable', time() + xxx time);[/code]

But that, when lookedup, contains the text "$variable". How do I put the variable's value in it instead?
Link to comment
Share on other sites

[!--quoteo(post=385130:date=Jun 17 2006, 05:48 PM:name=homchz)--][div class=\'quotetop\']QUOTE(homchz @ Jun 17 2006, 05:48 PM) [snapback]385130[/snapback][/div][div class=\'quotemain\'][!--quotec--]
Double Quotes.

Single quote represent actual text. So it will always print what is inbetween them.
[/quote]

Ah if only you'd had a syntax highlighting text editor, would have spotted that one instantly.
Link to comment
Share on other sites

The variable's not in double quotes, though. This is taken literally from the page:
[code] setcookie ("lap", '$name', time() + 3600);[/code]

That's exactly how it's in the page, but when the coolkie is echoed from another page, it actually says "$name".

Also, since I'm broke, I use notepad. Works for HTML pretty well, but not so much with PHP.
Link to comment
Share on other sites

[!--quoteo(post=385135:date=Jun 17 2006, 05:52 PM:name=habook2)--][div class=\'quotetop\']QUOTE(habook2 @ Jun 17 2006, 05:52 PM) [snapback]385135[/snapback][/div][div class=\'quotemain\'][!--quotec--]
The variable's not in double quotes, though. This is taken literally from the page:
[code] setcookie ("lap", '$name', time() + 3600);[/code]

That's exactly how it's in the page, but when the coolkie is echoed from another page, it actually says "$name".

Also, since I'm broke, I use notepad. Works for HTML pretty well, but not so much with PHP.
[/quote]

What!? You don't have to pay for syntax highlighting text editors! Just google it, there are a few good ones around for Windows. I use Linux though which is a free operating system and all the programs on it are completely free. It also comes with a text editor called Kate which is a joy to code with. It uses really sophisticated syntax highlighting and supports hundreds of languages as well keeping your tabs which is invaluable. Pity there's not a Windows version I know of, you could compile it from source I guess...
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.