General Programming Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingGeneral Programming Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here
  #1  
Old August 27th, 2002, 07:23 PM
nick316 nick316 is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2002
Location: N.S. Canada
Posts: 15 nick316 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
cookie question

Can someone have a look at this code:

<?PHP
session_start();
?>
<html>
<head>
<title>
PHP Test
</title>
</head>
<body bgcolor = "0033FF">
<?PHP
$username = "testingcookies";
setcookie("user", $0username, time()+604800); /* Expires in a week */
?>
<p>Testing Cookies</p>
</body>
</html>

and see if they can explain why it generates the error:


Warning: Cannot add header information - headers already sent by (output started at c:\program files\apache group\apache\wwwroot\cookies.php:11) in c:\program files\apache group\apache\wwwroot\cookies.php on line 13

Thanks in Advance,
Nick

p.s. There are no whitespaces at the top.

Reply With Quote
  #2  
Old August 27th, 2002, 07:36 PM
Ben Rowe
Guest
Dev Articles Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
they may be no white spaces, but your still sending the header out, you cant set a cookie, if you output anything
therefore, the very first line of your code needs to send out the cookie, no during the middle of the page, otherwise the headers has ready been sent

Reply With Quote
  #3  
Old August 27th, 2002, 07:41 PM
nick316 nick316 is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2002
Location: N.S. Canada
Posts: 15 nick316 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
got it

Thanks ben. I realized right after I posted that this was the problem.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingGeneral Programming Help > cookie question


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway