cookies #2

hi,

I have following problem.

I have a form wich I post to another php file there i want to store the data
form the form in a cookie.
code:

<?

foreach ($HTTP_POST_VARS as $key => $value) {



if($value=='ON')


{


setcookie("TestCookie","$key",time()+3600);

}



But it doens'n work. I have the following Error Warning: Cannot modify
header information - headers already sent by (output started at C:\Program
Files\Apache Group\Apache2

I understand the error and i have search in de tutorial form php.net, but
How can I handle this problem?



Thanks,



Alain




0
1/11/2004 1:44:05 PM
comp.lang.php 32612 articles. 0 followers. Post Follow

1 Replies
136 Views

Similar Articles

[PageSpeed] 16
Alain Dhaene wrote:

> hi,
> 
> I have following problem.
> 
> I have a form wich I post to another php file there i want to store the data
> form the form in a cookie.
> code:
> 
> <?
> 
> foreach ($HTTP_POST_VARS as $key => $value) {
> 
> 
> 
> if($value=='ON')
> 
> 
> {
> 
> 
> setcookie("TestCookie","$key",time()+3600);
> 
> }
> 
> 
> 
> But it doens'n work. I have the following Error Warning: Cannot modify
> header information - headers already sent by (output started at C:\Program
> Files\Apache Group\Apache2
> 
> I understand the error and i have search in de tutorial form php.net, but
> How can I handle this problem?
> 
> 
> 
> Thanks,
> 
> 
> 
> Alain
> 
> 
> 
> 

You must set cookies before sending any other output to the browser... 
including spaces, line feeds, etc.

Move your code that does cookies to the top of your PHP file.  Maybe 
that'll help ya.

Regards,

- Dan
http://www.dantripp.com/
0
thisIsNot (92)
1/12/2004 12:36:00 AM
Reply:
Similar Artilces:

[l/m 4/16/1998] Shell2 -- the outrigger (2/4) c.g.v.FAQ2 #2
#Disabled Archive-name: comp.viz.faq "Feed me." -- Audrey II, the Plant in "The Little Shop of Horrors." Contents ======== Intro ----- What is visualization? ---------------------- Systems ------- Issue/problems -------------- Netiquette ---------- References ---------- ================================ Intro ----- The quality of this FAQ is directly proportional to the information mailed by participants (that's you) to the maintainer (me, Amelia). You don't like it? Blame the rest of the posters and readers. I don't have 100% ...

Default value being a concatenation of other columns #2
Hello all, Does anybody know if it is possible to set the default value of a field to equal the concatenation of 2 other fields? I.E. Field 1 = 123 Field 2 = 345 Field 3 = (Field1 + Field2) = 123345 This is easy enough to do using a stored procedure, but I'm trying to use the import tool and so need to do the concatenation by default. Many thanks, Drew. Drew (andylole@gmail.com) writes: > Hello all, > > Does anybody know if it is possible to set the default value of a > field to equal the concatenation of 2 other fields? > I.E. > Field 1 = 123 > Field 2 = 345 >...

Laser Disc support under M-Control Program/2 (part of MMPM/2)
Announcement Letter Number 292-663 http://www-01.ibm.com/common/ssi/ShowDoc.wss?docURL=/common/ssi/rep_ca/3/897/ENUS292-663/index.html&lang=en&request_locale=en M-Control Program/2 Version 2.01 o The following videodisc players or their functional and interface equivalent have attachment interfaces supported by Version 2.01 under MMPM/2: - Pioneer (3) LD-V6000 - Pioneer LD-V6000A - Pioneer LD-V6010A - Sony (4) LDP-1200 - Sony LDP-1450 - Sony LDP-1500 - Sony LDP-1550 - Sony LDP-2000 - Sony LDP-360...

Problem with DATA_B3_IND #2
Hi all, i am trying to write a application that answers an incomming call. The remote site is a modem using v.23 hdx 1200 with Takt and SYNC.-Wechsel.( l read the setting directly from the pannel of that modem). Now my problem is: my application has only got a DATA_B3_IND then followed with DISCONNECT_B3 IND (cause:clearing according to protocol). the DATA_B3_IND comes in 10 seconds later after CONNECT_ACTIVE IND and CONNECT_ACTIVE RESP is done. l have tried many combination of B protocol: e.g B1=7,B2=7,B3=7 or B1=8,B2=1,B3=7 but the result is always the same... can any body...

UltraOptimizer 2.1
The UltraOptimizer application was designed to be an advanced registry analyzer and optimizer, that can boost your computer's performance and improve the overall speed of your system. It offers an extremely powerful and stable scanning technology, and complete protection against data loss during the optimization process. It also features a powerful defragmentation engine, that allows you to improve the access to the system registry by optimizing disk accesses to the files that comprise your Windows registry. Ultra Optimizer is the most advanced Windows Registry Cleaner and Sys...

how to list all loaded modules of a perl program #2
Hi group, is it possible to list all loaded modules of a perl program? For example, the perl application could have a very complicated hierarchy of module structure where each module load different modules on their own: i.e package main use A; use C; package A use B; package C use D; package B use BA; use BB; package D; use DA; use DB; use DC; package DA use DAA; use DAB; etc, etc. Now is it possible within the main program to list all the preloaded modules via use statement? It's possible to do this by using a parser to recursively parse through modules with a predefined level, bu...

Strange scilab 5.2.2 in the classroom
I've started using scilab 5.2.2 in a lab class. Last year we used 5.1 or 5.1.1. Here are some strange things I can't figure out. Another variable is that the lab moved from XP to Windows7. 1. A sudden failure of old code: Eventually it was discovered that the rand command was in 'normal' mode and not 'uniform'. The 'normal' mode reappeared after restart. Changing via rand('uniform') fixed this. But I could not reproduce it. 2. The student lesson had for loops. While both abort and interrupt worked for my sessions when I was in student mode, a...

Re: optparse question (python 2.6)
--047d7bf0e4268aae5404e567497a Content-Type: text/plain; charset=ISO-8859-1 Hi all, I tried with the example Peter gave me, and it works. But only when the options are boolean. At least, that is my conclusion with experimenting. I'll elaborate: The code to create 'mutually exclusive options': option_names = [ "l", "o" , "s" ] toggled_options = [name for name in option_names if getattr(opts, name)] if len(toggled_options) > 1: s = repr(toggled_options).strip("[]") parser.error("options %s are mutually exclusive...

what basic DSP books do you advice? #2
Hi Rob. For DSP beginners, I don't think it is possible to avoid our friend Rick Lyon's "Understanding DSP", Prentice Hall, 2004. It's as ideal for self-learning as I think a book ever can be. The second book after that, is a bit more difficult. For generic DSP, I would suggest Proakis & Manolakis: "Digital Signal Processing. Principles, Algorithms and Applications" Prentice-Hall, 3rd ed. 1996. This is a standard text on DSP, but may be a bit tough for self-learning. Still, I think you need it (or something similar) for some of the more advanced...

EPS figure adopting text color #2
Hi there, I have a nice EPS file with a symbol which shall be included in the text and adopt the text color. The EPS file consists of drawing a path and then filling it -- with the current text color?! However, the symbol is always blacks. How can this issue be done correctly? In order to make things clear, I have appended an example. Thanks for any helpful hints! Erwin ---TeX file--- \documentclass{article} \usepackage{graphicx,color} \begin{document} \color[named]{Red}Red letters. \includegraphics[height=2ex]{test.eps} \end{document} ---test.eps--- %!PS-Adobe-2.0 EPSF-2.0 %%Boundin...

Could not open font 'fixed' message PART 2
Hi , I have a server Linux with RedHat 8.0 showing the following error during the boot (WW) ATI(0) .Failed to setup write-combining range (0xfd0000000,0x00000000) (WW) ATI(0) .Failed to setup write-combining range (0xfd0000000,0x00000000) Error loading keymap /var/tmp/server-0-xkm Couldn't load XKB keymap, falling back to pre-XKB keymap Could not init font path element unix/:7100, removing from list If you encounter a server crash , please report the problem by filling a bug report in the XFree86.org bugzilla at http://xfree86.org and/or Red Hat bugzilla at http://bugzilla .re...

Difference between include and require #2
When we want to call another file in the existing file at that time we can use include and require both.Please tell me what's the difference between them? Bunty wrote: > When we want to call another file in the existing file at that time we > can use include and require both.Please tell me what's the difference > between them? Have you tried a google of "php include require difference"? If you want answers in this group (or any others) you have to demonstrate that you have done at least a modicum of homework. ..oO(Bunty) >When we want to call another file in...

How do I enable Cookies?
My Bank (NatWest) wants me to enable Online Banking. But, when I goto www.natwest.com all I get is an error message telling me that unfortunately my browser does not accept Cookies, which are essential to the operation of the service. How does one enable Cookies on (a) !Netsurf; and/or (b) !Fresco? Or do I have to go Mickey$oft? TIA Ben -- _ __________________________________________ / \._._ |_ _ _ /' Orpheus Internet Services \_/| |_)| |(/_|_|_> / 'Internet for Everyone' _______ | ___________./ http://www....

Announcing: CHICKEN 2.3
The CHICKEN Scheme-to-C compiler, Version 2.3 is now available at <http://www.call-with-current-continuation.org>. Things changed since the last release (2.2): - Many many bugfixes - compiler: * new option `-profile-name FILENAME' - the `chicken-config' script has been removed, identical functionality can be provided by `csc' - csc: * new option `-objc' compiles generated C files in Objective-C mode * accepts .m files and handles the case when only object files are given * new options `-framework', `-F<dir>' and `-rpath' * options `-home&#...

Connecting Notes to Domino #2
Hello, I have downloaded a trial Domino and Notes applications. I have this problem: Notes doesn't connect to Domino, saying: "Server you connected to has a different name from the one requested". Now, I've been trying to use Client Reconfiguration Wizard, but it didn't reconfigure a f.k :-) What shall I do? TIA, -- Andrea Raimondi REICOM S.r.l. Software Developer ***************************************************** REICOM S.r.l. Wireless Technologies A member of the European Low Power Radio Association. Societ´┐Ż di progettazione di impianti di ...

Mozilla/Firefox often "forget" cookies
For a long time now I've been having a particular problem with every version of Mozilla and Firefox I've used, but only on the Mac platform. So I thought I'd mention it here and see if anyone knows of a fix. The problem is that Mozilla/Firefox expires or loses all of my cookies after a certain period of time. No, they don't all expire at the same time. But for each web site I visit that requires login, I have to re-login every few weeks, even though I've never explicitly logged out. I've been logged in to some of these same sites for many months using Mozilla/Fir...

Migrating cloudscape 3.6 to oracle. #2
hello, Presently i am working with Cloudscape 3.6 database, i want to migrate to oracle 9i,please guide me so as that i can migrate to oracle. Thanks & regards Kiran. ...

Changing overall font size on the fly + storing in cookie
I have looked on Google for a solution to change CSS properties of several CSS elements of a page. All solutions I have found are server-side solutions with cookies. What I'm looking for is a client-side solution with a cookie to store user preferences. I just want to increase/decrease font-size for body, and width (780px or 100%) for a div tag. Is there a JavaScript that does this or something similar and stores the preferences on the user's computer? Thanks, -- Kerberos. http://www.opera.com http://www.freebsd.org http://www.auriance.com http://www.osresources.com ht...

wxFileConfig MSW, 2.4.2 problems
Hi all, I have some problems with wxFileConfig. 1./ The class itself is missing from the docs, even Search cannot find it. Since this subclass has some peculiarities, it would be desirable to have a link to the description in the docs. 2./ I think there is a bug in the design of the constructor. In wxFileConfig::Init(), if the config file exists, the file is Parse()d, whether is desirable or not. In my particular case, I would like to write out the current configuration to a file on the request of the user. Let us suppose I read a configuration from file A, then I want to s...

setting a cookie
this is not specifically behaviour related, but i thought i would risk asking anyway. i am working on a script that triggers a blind down or blind up effect by clicking on a particular link. it then remembers the status of that choice by setting a cookie. the technique was taken from here: http://www.exit404.com/2005/57/unobtrusive-persistant-scriptaculous-effects here is my rule 'a.tools' : function(el){ el.onclick = function(){ if (Element.hasClassName('tool-box', 'invisible')) { new Effect.BlindDown('tool-box'); Element.removeClassName(&...

AllWebMenus Pro 4.2.658 #2
AllWebMenus is a dhtml menu/javascript menu builder for web navigation that requires absolutely no DHTML or Javascript experience. It creates any cross-browser, popup or drop-down web menu that works alike in all browsers supporting DHTML held by all popular platforms (PC, MAC, Unix). DHTML/JavaScript menus are designed with a treelike approach. Users can tailor their menus by using the Properties Pane or by choosing from a series of predefined themes from the Theme Gallery. The menu can be either vertical or horizontal (pop-up or drop-down menu), it can be movable, stay visible whi...

Re: 497 million euro fine for Microsoft #2
> [...] read Clayton M. Christensen: "The Innovator's Dilemma." [...] > when new products using disruptive technologies enter a market and the > new product does not meet the main customer groups needs, has a low > gross margin and the potential market is little. When the new product > becomes better, it pushes the old products out of the market. Linux is not a "disruptive technology" -- it's mostly Unix, which has been around forever (in computer terms). I do see it pushing out other Unixes, but that's not "disruptive". Windows,...

Re: Column Operation #2
Hi Sumanta, Ambiguous question: do you want to delete companies, i.e. rows if there are missing data in it? Or do you want to remove complete variables (columns), also the non-missing values in other records? Or do you want to delete cells, variables for certain companies? Well, you never can delete cells. SAS datasets have a rectangular structure. You can only DROP variables (columns) and DELETE records (rows). I think you should not remove anything but leave things as they are. You say you have huge data, but 30x40 is small I think. Regards - Jim. -- Jim Groeneveld, Netherlands Statistic...

vexing object design issue #2
Hello everyone, I am having a vexing object design issue that bugs me: Having a business object for each table like customer is fine. But what happens when you create a view that merges multiple tables? I don't like duplication and I don't want to duplicate certain get accessor functions (properties) in both objects in the new object. What is the best approach? For example: class customer function GetFirstName: does some business rules (say 20 lines of code) class product function GetProductPrice: does some business rules (say 20 lines of code) class SomeSillyListBox this clas...

RE: Do extents impact speed? #2
It is exactly because of the advances in technology,memory and disk size, that I first asked the question. We are using fully mirrored and striped logical volumes on AIX. We only have one or two mirrored disk pairs so there seems to be little benefit in putting different dbspaces/tables/fragments on different disks. (The only constraint we have on chunks is a 2Gbyte limit which comes from IDS 9.3 days) Doing a dbexport/dbimport to defragment is a non-starter. A VAR application is involved and they do not support the use of dbexport/dbimport. Instead they provide their own ut...