SOLVED - Session or Cookie?
Moderator: General Moderators
- johnperkins21
- Forum Contributor
- Posts: 140
- Joined: Mon Oct 27, 2003 4:57 pm
Dave, I tried your idea and got the following error:
PHP Warning: Cannot add header information - headers already sent by (output started at /tenyardfight/testcookie.php:3) in /tenyardfight/testcookie.php on line 4
I don't see how there are any headers being sent? I copied your code exactly as a test.
PHP Warning: Cannot add header information - headers already sent by (output started at /tenyardfight/testcookie.php:3) in /tenyardfight/testcookie.php on line 4
I don't see how there are any headers being sent? I copied your code exactly as a test.
-
TheBentinel.com
- Forum Contributor
- Posts: 282
- Joined: Wed Mar 10, 2004 1:52 pm
- Location: Columbus, Ohio
Duh, sorry John. Geesh, I need another coffee this morning.johnperkins21 wrote:Dave, I tried your idea and got the following error:
PHP Warning: Cannot add header information - headers already sent by (output started at /tenyardfight/testcookie.php:3) in /tenyardfight/testcookie.php on line 4
I don't see how there are any headers being sent? I copied your code exactly as a test.
Take out all the HTML before the <?php, so <?php is the first thing in the file.
(The cookies are sent in the header, but I had you output html code which goes AFTER the headers.)
- johnperkins21
- Forum Contributor
- Posts: 140
- Joined: Mon Oct 27, 2003 4:57 pm
-
TheBentinel.com
- Forum Contributor
- Posts: 282
- Joined: Wed Mar 10, 2004 1:52 pm
- Location: Columbus, Ohio
Try cutting out some of the optional stuff. I think all that's mandatory is the name and the value. Does this work?johnperkins21 wrote: still not setting the cookie. Strange.
Code: Select all
<?php
setcookie("MyName", "MyValue");
?>- johnperkins21
- Forum Contributor
- Posts: 140
- Joined: Mon Oct 27, 2003 4:57 pm
- johnperkins21
- Forum Contributor
- Posts: 140
- Joined: Mon Oct 27, 2003 4:57 pm
-
TheBentinel.com
- Forum Contributor
- Posts: 282
- Joined: Wed Mar 10, 2004 1:52 pm
- Location: Columbus, Ohio
That's great, congrats!johnperkins21 wrote:Dude, I played with it for about an hour or so, and I finally got it working.
[rant]
"So, how long will it take," asks the Boss. How do you estimate time acurately when it takes two days to put down a cookie! It's the dumb little stuff that eats up development time.
[/rant]
- johnperkins21
- Forum Contributor
- Posts: 140
- Joined: Mon Oct 27, 2003 4:57 pm
smart enough to solve your own problems.. most people just want to use this board to have the others code for them.johnperkins21 wrote:I'm kind of dumb.
Yeah, a forgotten ";" a ) missing. Its those mistakes that make u a stronger coder when your in notepad(or whatever you use to code in) typing away. you'll see you'll make less n less as you learn more n more!johnperkins21 wrote:And it almost always turns out to be something either easy or stupid
[/uncle_tom_talk]