Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Jun 14th, 2008, 10:07 PM   #1
Logical1
Programmer
 
Logical1's Avatar
 
Join Date: Apr 2008
Posts: 47
Rep Power: 0 Logical1 is on a distinguished road
Question Header is ...

I am sure everybody had this problem at one point or another and I have done A LOT OF reading about it but still problem presists.
I keep on getting Error message saying header is already sent! The coockie thing is the very first line. I have removed all the spaces, even tried sticking it to the end of <?php still not working!
Any ideas as why?

My code is:
<?php
setcookie($A,10);
print "<head>\
<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"><style type=\"text/css\">
<!--
A{text-decoration:none}
-->
</style>.................................CONTINUES HERE
";
__________________
^c^
Logical1 is offline   Reply With Quote
Old Jun 14th, 2008, 10:40 PM   #2
Sane
Programming Guru
 
Sane's Avatar
 
Join Date: Apr 2005
Posts: 1,827
Rep Power: 5 Sane will become famous soon enough
Re: Header is ...

Have you defined $A to be something? And if so, where? Is something being printed there? And if not, then there's your problem.
Sane is offline   Reply With Quote
Old Jun 14th, 2008, 11:07 PM   #3
Logical1
Programmer
 
Logical1's Avatar
 
Join Date: Apr 2008
Posts: 47
Rep Power: 0 Logical1 is on a distinguished road
????

setcookie(A,'10');

what do you mean "define". This is where I set the value 10 to A and that's that. It does not get printed anywhere in the same page or any page after because I am getting the error message which means the cookie is not set.

I have tried this with session_start() also. Get the exact same problem.
Include your code if you have a suggestion and I try it becasue really it is making no sense to me.
__________________
^c^
Logical1 is offline   Reply With Quote
Old Jun 14th, 2008, 11:37 PM   #4
Apophis
Newbie
 
Join Date: Apr 2008
Posts: 16
Rep Power: 0 Apophis is on a distinguished road
Re: ????

I beleve the problem is to do with you making a cookie then setting meta infomation.
try using ob_start() and ob_end_flush();
Apophis is offline   Reply With Quote
Old Jun 15th, 2008, 12:05 AM   #5
Sane
Programming Guru
 
Sane's Avatar
 
Join Date: Apr 2005
Posts: 1,827
Rep Power: 5 Sane will become famous soon enough
Re: Header is ...

Quote:
Originally Posted by Logical1 View Post
what do you mean "define". This is where I set the value 10 to A and that's that.
PHP, just like every language, has variables that need to be defined. It does not know what "$A" is. $A has to be defined as some string. So unless you have a previous declaration of $A, your code will obviously not run.

Read the manual. PHP: setcookie
$A = "TestCookie";
$value = 'something from somewhere';
setcookie($A,$value);

If what you posted isn't the full code, and you have in fact defined $A, then you should use ob_start() and ob_end_flush() as Apophis suggested.
Sane is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I silence header? stu7398 PHP 4 Jan 13th, 2008 6:15 PM
making a header file alphonso C++ 14 Apr 5th, 2006 6:32 AM
question about header files and prototyping functions linuxpimp20 C 13 Sep 7th, 2005 8:28 AM
Header files Klarre C++ 13 Jun 15th, 2005 11:25 AM
TCP Header for Echo Communication AusTex C++ 0 Feb 27th, 2005 3:57 PM




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 11:02 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC