[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

create a cookie

Posted on 2000-02-18
3
Medium Priority
?
181 Views
Last Modified: 2008-03-06
I am creating a cookie?I am not using any <html> or <head> tags before it.There is only  database connection and retrieving some values from it.I am getting Error as "cookie is Set after header is passed".what is the solution?
0
Comment
Question by:padmamvs
3 Comments
 
LVL 2

Expert Comment

by:maxkir
ID: 2538459
check any require() or include() directives before sending a cookie in your text.
I bet that some of the included files outputs some blank characters.

I mean, if you make

include("config.inc");
SetCookie(...);

and file config.inc is like that:
<?php
//stuff
?>
[spaces]
-- end of file --
then these spaces are sent before your SetCookie command - so PHP gives an error.
0
 

Expert Comment

by:tejass
ID: 2539516
I completely agree with maxkir
0
 
LVL 1

Accepted Solution

by:
aikon earned 40 total points
ID: 2539840
Hi padmamvs,

The cookie code must be before any code you put ei php or html.

Regards.
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
It’s a season to be thankful, and we’re thankful for users like you who engage on site, solve technology problems, and network with others in the industry. What tech are we most thankful for? Keep reading.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Suggested Courses
Course of the Month19 days, 7 hours left to enroll

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question