Solved

create a cookie

Posted on 2000-02-18
3
177 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 20 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: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone 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

Suggested Solutions

Generating table dynamically is the most common issue faced by php developers.... So it seems there is a need of an article that explains the basic concept of generating tables dynamically. It just requires a basic knowledge of html and little maths…
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to dynamically set the form action using jQuery.

749 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