[SOLVED] cookies... please help!!!!

This is a discussion on "[SOLVED] cookies... please help!!!!" within the PHP Forum section. This forum, and the thread "[SOLVED] cookies... please help!!!! are both part of the Program Your Website category.


 Subscribe in a reader

Go Back   Webforumz.com > Main Forums > Program Your Website > PHP Forum

Notices




Reply
 
LinkBack Thread Tools
  #1  
Old Jan 14th, 2008, 00:58
Junior Member
Join Date: Sep 2007
Location: Philippines
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
[SOLVED] cookies... please help!!!!

hi there... i'm just starting to learn php, and to tell you honestly i'm really having a hard time learning it, but that's just fine. That's the challenge of programming. And even it's hard, i'm really enjoying it. ok..! now I just wanna ask something about cookies. Here is the sample cookie.
PHP: Select all

<html>
<head>
<title>Cookies</title>
</head>

<body>
    <?php setcookie('test'45time()+(60*60*24*7)); ?>

</body>
</html>
i must see a blankpage here right? because i just set a cookie. But instead of getting a blankpage, What i get is a warning. like this "Warning: Cannot modify header information - headers already sent by (output started at C:\wamp\www\php_sandbox\cookies.php:7) in C:\wamp\www\php_sandbox\cookies.php on line 7" can anyone please tell me what went wrong? please... help.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote

  #2  
Old Jan 14th, 2008, 01:41
Most Reputable Member
Join Date: Feb 2004
Location: Borneo
Age: 27
Posts: 1,612
Blog Entries: 2
Thanks: 0
Thanked 4 Times in 3 Posts
Re: cookies... please help!!!!

Could you post your full code here!

I think this usually happen when you have a blank line before the <?php or maybe you include header.php before you process the page!
Last Blog Entry: ASP Programming Tips and Technique (Oct 26th, 2007)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3  
Old Jan 14th, 2008, 02:10
Junior Member
Join Date: Sep 2007
Location: Philippines
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Re: cookies... please help!!!!

hello monie... thank you for your reply. but i think i figured out what went wrong, and it's in the php.ini file because the output_buffering is previously set to "OFF". now that i put a specific value for that, i'm not getting the same warning anymore. Thank you again for you're reply and intention too help me. more power and have a nice day.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #4  
Old Jan 14th, 2008, 02:17
Most Reputable Member
Join Date: Feb 2004
Location: Borneo
Age: 27
Posts: 1,612
Blog Entries: 2
Thanks: 0
Thanked 4 Times in 3 Posts
Re: cookies... please help!!!!

Ahh.. Thanks for sharing the solution
Last Blog Entry: ASP Programming Tips and Technique (Oct 26th, 2007)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #5  
Old Jan 14th, 2008, 05:51
alexgeek's Avatar
Moderator

SuperMember
Join Date: Jul 2007
Location: Webforumz 24/7
Age: 15
Posts: 3,812
Blog Entries: 9
Thanks: 2
Thanked 2 Times in 2 Posts
Re: [SOLVED] cookies... please help!!!!

Solved!
A cookie is sent as a header so it must be sent before the first <html> or before any output.
This also goes for sessions, headers and more.
Last Blog Entry: 3D Chess in your browser! (Mar 14th, 2008)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
cookies in PHP marquey PHP Forum 4 May 31st, 2007 17:17
how to store cookies selphie08 Flash & Multimedia Forum 3 Sep 20th, 2006 01:54
ASP Cookies señorbadger Classic ASP 6 Nov 22nd, 2003 14:04
Flash Cookies! Webforumz Staff Flash & Multimedia Forum 0 Sep 3rd, 2003 12:09


All times are GMT. The time now is 13:09.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42