?
Solved

create a cookie

Posted on 2000-02-18
3
Medium Priority
?
179 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Part of the Global Positioning System A geocode (https://developers.google.com/maps/documentation/geocoding/) is the major subset of a GPS coordinate (http://en.wikipedia.org/wiki/Global_Positioning_System), the other parts being the altitude and t…
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
Suggested Courses

765 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