cookies #2

  • Permalink
  • submit to reddit
  • Email
  • Follow


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
Reply alain.dhaene1 (15) 1/11/2004 1:44:05 PM

See related articles to this posting


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
Reply thisIsNot (92) 1/12/2004 12:36:00 AM
comp.lang.php 32523 articles. 6 followers. Post

1 Replies
90 Views

Similar Articles

[PageSpeed] 54


  • Permalink
  • submit to reddit
  • Email
  • Follow


Reply:

Similar Artilces:

cookies #2 #2
hello folks. PPC 10.5 Safari 5.0.6 is set to never accept cookies and as I'm watching the cookies window and going between sites on 10.5 a google cookie keeps popping up. Anyone know why this is happening? It seems it's being sent to my browser every so many minutes after I delete it. I set database storage to none and it's still popping up in the cookie window. Regards In article <0001HW.CAA3FCEA0032597CF01846D8@unlimited.newshosting.com>, Whitey Black <whiteyblack562@aol.com> wrote: > hello folks. PPC 10.5 Safari 5.0.6 is set to never accept cookies and a...

Session Cookie Glitch with mod_perl 2.03 and Apache 2.2.6
I have an application originally written for the combination of Apache 1.3.31, mod_perl 1.39, and MySQL 4.0.16 that I'm moving to new servers so I wanted to take the opportunity to migrate these components to the latest versions: Perl v5.8.8 built for i586-linux-thread-multi Apache 2.2.6 mod_perl 2.0.3 OpenSSL 0.9.8g libapreq 2-2.08 MySQL 5.0.45 The APIs for mod_perl changed substantially between 1.0 and 2.0 so I've gone through the code that involves the old 1.0 vintage Apache::xxxxxx modules and updated them to 2.0 equivalents in the Apache2::xxxxxx or ModPerl::xxxxxxx modules. Th...

linspace(2,2,2) returns [2 2] ??
May be the help for linspace should change? It says: "LINSPACE(X1, X2, N) generates N points between X1 and X2." Notice, it says BETWEEN. But when I ask for 2 points, between 2 and 2: ---------------- EDU>> linspace(2,2,2) ans = 2 2 --------------- May be mathematically this is ok? i.e. there are infinite points between the point and itself? (on the real line), but from programming point of view, it is confusing. no? --Nasser Maybe it should say "generates N points between X1 and X2, inclusive." What did you expect to...

2 * 2 * 2 * 2 or pow(2, 4)?
Hi , I hope this isn't too trivial to ask, but I'm evaluating a polynomial that involve lots of terms like x^2y^2z^3, and although I can use the power function pow(a, b), I wonder if just writing x*x*y*y*z*z*z for example wouldn't be more efficient than pow(x, 2)*pow(y, 2)*pow(z,3). Or is it all the same? Thanks, - Olumide Olumide wrote: > I hope this isn't too trivial to ask, but I'm evaluating a polynomial > that involve lots of terms like x^2y^2z^3, and although I can use the > power function pow(a, b), I wonder if just writing x*x*y*y*z*z*z for > exam...

2**2**2**2**2 wrong? Bug?
In Python 2.5 on intel, the statement 2**2**2**2**2 evaluates to >>> 2**2**2**2**2 20035299304068464649790723515602557504478254755697514192650169737108940595563114 53089506130880933348101038234342907263181822949382118812668869506364761547029165 04187191635158796634721944293092798208430910485599057015931895963952486337236720 30029169695921561087649488892540908059114570376752085002066715637023661263597471 44807111774815880914135742720967190151836282560618091458852699826141425030123391 10827360384376787644904320596037912449090570756031403507616256247603186379312648 4703743782954975613770...

[5.2.2/cURL] Not getting cookies?
Hello So I'm trying to use cURL to write a PHP5 script that is effectively a proxy, since the browser will call this index.php which will fetch pages from a remote server, and pass them on to the browser, including cookies. For some reason, cURL fails creating the file that holds cookies ("CookieJar not created!"), although I copy/pasted this code from cURL's web site (http://curl.haxx.se/libcurl/php/examples/cookiejar.html): ========= <?php //Using one script for different steps $status = ($_POST['status']? $_POST['status'] : $_GET['status'])...

2.2.2 Annoyance
Caveat: Python 2.2.2 (#37, Oct 14 2002, 17:02:34) Type "help", "copyright", "credits" or "l >>> l = [1,2,3] >>> l[1] 2 >>> l.__getitem__(1) 2 >>> l.__getitem__(slice(1)) Traceback (most recent call last): File "<stdin>", line 1, in ? TypeError: an integer is required >>> According to the manuals of Python 2.2.2, passing a slice object to __getitem__ is all right and should work... Cost a few (grey) hairs of mine, while debugging a largish program, this is not so. Would someone care to pass on th...

VIBE 2.2 #2
About: Visual Information Broker Enterprise (VIBE) is an IDE that enables application developers to automate the design and development of infrastructure components for complex distributed cross-platform, cross-language systems applications. You can define messages and generate infrastructure support code for the IBM MQ information bus, Sybase, Microsoft SQL Server, Oracle, and other JDBC compliant databases, XML with transformations that use tools like XSL, and J2EE. It also includes a fully functional Business Rules engine, along with a graphical programming environment. Changes: This relea...

OTM 2.2 #2
Hi all Just installed OTM on a cust pc (Win XP) Got a problem that when using the system terminal to access Meridian Mail, I am unable to exit from mail as the Cntrl ] function is not recognised. Now is this a problem with OTM or with the customers PC? Thanks Solved it. The term type was set to VT100 and not VT220 ...

what is 4.2.2.2
Hi I came to found from many websites when i had a problem in Internet explorer when if i browse any websites, its showing me "Page cannot be displayed" and in bottom of the page it shows "Cannot find server or DNS Error" Internet Explorer that they advised me to put 4.2.2.2 in my Primary DNS Server. I am in DHCP enabled Network and using windows xp sp2. My question is what is this ip address mean (4.2.2.2) ? Pl explain in detail. Can we give it in our Primary DNS server ? Thanks in advance Chandra -- chandra Message posted via HWKB.com http:...

Printing 2^1, 2^2, 2^3, 2^4 and 2^5
Hi, When I use a while loop, the output is: 2 4 8 16 32, as desired: <?php $c=1; while($c<=5) { $d = newpow(2, $c); print "$d "; $c++; } function newpow($base, $power) { // statements... } ?> The But when I use a for loop, the output is: 64: <?php for($c=1; $c<=5; $c++); { $d = newpow(2, $c); print "$d "; } function newpow($base, $power) { // statements... } ?> Why is this?? Many thanks, Michael mejpark wrote: > When I use a while loop, the output is: 2 4 8 16 32, as desired: [...] > The But when I use a for loop, the output is: 64...

Does 4/2/2= (4/2)/2 =1 OR = 4/(2/2)=4
I don't have matlab and I am trying to translate some simple matlab code. Does 4/2/2 = (4/2)/2 = 1 or 4/2/2 = 4/(2/2) = 4 On 9/11/2012 9:43 AM, sarah.englander@gmail.com wrote: > I don't have matlab and I am trying to translate some simple matlab code. > > Does 4/2/2 = (4/2)/2 = 1 yes. At a given precedence level (and obviously two of the same operators are the same level) evaluation proceeds from LtoR. ....snip... <http://www.mathworks.com/help/techdoc/matlab_prog/f0-40063.html#f0-38155> -- dpb <none@non.net> wrote in message <...

how to do this? #2 #2
Hi, I am working on a program which can do numerical evaluations for integrations. The program I have is like this, double foo(p1, p2) double p1, p2; { double kk,step; int ii; step_sz=(p2-p1)/100.; kk=0.; for (ii=0;ii<100;ii++) kk+=sin(p1+ii*step_sz)*step_sz; return (kk); } This program used the basic Newton method. My question is here in my program foo, I can only calculate the integrations for a sine function. If I want to do an integration for a cosine function, I need to rewrite another function foo1 with cosine being inserted in. I am sure there is a neat way to do this wit...

2+2
4 -- ��Dreamweaver, being the #1 pro web design tool, is used by many pros � Different viruses are still different even if in the same "family" � OS X users are at far less risk of malware then are XP users _________________________________________ Usenet Zone Free Binaries Usenet Server More than 140,000 groups Unlimited download http://www.usenetzone.com to open account On Mon, 03 Jul 2006 23:35:36 -0700, Snit <SNIT@CABLE0NE.NET.INVALID> chose to bless us with the following wisdom: >4 Way I love the little girl, you'll never know Come on, baby don't you wan...

2 + 2 =
2 + 2 = 4. Period. ...

cookie #2
What's the best I can do to solve my trouble : I got a simple page index-tmp who include a code snippet who test if a cookie exist and if yes redirect to the user account page but the trouble is when I didn't 've a cookie the page still redirect to the user account page. here is the following code : <? $cookie = $_COOKIE["free-nickname"]; if (!cookie == null) { echo '<script langage = "javascript">'; echo " document.location.href = 'index_utilisateur.php';"; echo '</script>;'; } else { echo '...

What does this do? #2 #2
Im trying to fix two libraries to be compatible with Ruby 1.9 - gruff and pdf-writer, and I came accross this: SyntaxError: /usr/local/lib/ruby/gems/1.9/gems/gruff-0.3.4/lib/gruff/mini/legend.rb:72: invalid multibyte char (US-ASCII) /usr/local/lib/ruby/gems/1.9/gems/gruff-0.3.4/lib/gruff/mini/legend.rb:72: invalid multibyte char (US-ASCII) /usr/local/lib/ruby/gems/1.9/gems/gruff-0.3.4/lib/gruff/mini/legend.rb:72: syntax error, unexpected $end, expecting ':' ...ength < label.to_s.length ? "â¦" : '') This is the gruff code: truncated_label + (truncated_...

2 or not 2
is this a question! http://members.iinet.net.au/~moussa/Image029.jpg Should I? the in house auction is tomorrow :-/ Moussa -- The information contained in this post is copyright of the poster, and specifically may not be published in, or used by http://www.jlaforums.com Il Wed, 09 Sep 2009 16:13:08 +0800, Cheers ha scritto: > is this a question! > > http://members.iinet.net.au/~moussa/Image029.jpg > > Should I? the in house auction is tomorrow :-/ > > Moussa I don't know it but it's BIG ! Do you have free space ? How much, do ...

from python1.5.2 to python2.2.2 #2
Hi, I have a lot of scripts written in python1.5.2 that I want to bring in python2.2.2. Someone could give me some informations about the sintax difference between this 2 version? Where can I get documents about it? Are there some available tools to do this automatically? thanks Alberto In article <3ef166ac.3608218@news.marelli.it>, Alberto Mantovani <alberto.mantovaniNOSPAM@bologna.marelli.it> wrote: > >I have a lot of scripts written in python1.5.2 that I want to bring in >python2.2.2. Someone could give me some informations about the sintax >difference between th...

OSK 2.0, 2.2 and 2.3
Does anyone here have any of the versions named in the subject? I am unravelling 68K Basic I-Code, and I need to compare 2.0, 2.2 and 2.3 modules with 2.1 and 2.4 modules. There are differences between 2.1 and 2.4, and I want to know how many other differences there are between versions. Thanks in advance. Wayne Campbell ...

problems with in 2.3.2 developed modules used with 2.2.2
Sorry for the long header of this mail ;-) Has anyone experienced modules developed in 2.3.2 (using IDLE and = PythonWin as IDE) don't work under 2.2.2.... I mean basic stuff like it = can not see classes from your .py file, so an import fails? It almost likes that in my case 2.2.2 doesn't like the file format = generated by IDLE or PythonWin in 2.3.2. Does someone know if this is a known problem? Vincent Try deleting the .pyc version of the file... maybe 2.2.2 doesn't realize that the magic number is wrong and that it should recompile from the .py source. Kevin. "Raa...

Blender 2.34 and Python 2.1, 2.2, 2.3
If you can run python scripts in blender 2.3x, I'll be glad to know which versions did you install. Checking at blender.org, I found that blender 2.34 is built with python 2.3. However, I don't want to perform an installation of python 2.3 if I'm not sure that it fixes my problem (I found some people saying that this problem is fixed by downgrading from python 2.3 to 2.2, and also the freeware.sgi.com python is still at 2.1.1, so I've no idea on the best option). Before playing with a custom installation of python, I'm posting the problem here with the hope that s...

Upgrade from VO 1 - 2 - 2..1 -2.2 - 2.3 -2.4 - 2.5 - 2.6 - 2.7
About upgrade 2.5 - 2.7 at $ 384.00 For most products I'm using - the updates (2.0 - 2.1 - 2.7) are free... 2.0 to 3.0 might be worth + 10-30% of the original price? VO is + full price again & again - Full program price for every minor upgrade/bug-fix? I dropped out of the money/bugs [VO] at 2.5 after starting at 1.0 more than 10 years ago. Certainly whoever is making VO have to make a living; earning moneys: - that is OK! A 10 years old VO site; - 10 years later, how much have changed? http://www.yi.com/prany/cavo/cavofront.htm Even MS is not ...

[ANN] gettext-2.0.2, gettext_activerecord-2.0.2, gettext_rails-2.0.2
Hi, Ruby-GetText-Package-2.0.2 and the families (gettext-2.0.2, gettext_activerecord-2.0.2 and gettext_rails-2.0.2) are now available. Ruby-GetText-Package is the library/tools for message localization. * gettext - Message localization libraries and tools for all kind of apps/libs. * gettext_activerecord - ActiveRecord Localization * gettext_rails - Rails support with gettext. Changes ------- == gettext-2.0.2 * Support ruby-1.9.1 style format string such as %<foo>d. * Apply new Locale.set_app_language_tags and Locale.candidates. [Suggested by Vladimir Dobriakov] * Enhance...