But, I tend to go the setcookie() route most of the time.
I don't use the frameworks, I feel like I'm cheating on a test.
I guess you use whatever you're used to.
Glad you got it all squared away.
@Matt Knowlton
It's only cheating if you don't know the answers at the core. If you know PHP, then you can figure out the core of the Framework and it will only streamline your building process. Cheating would be using said framework without understanding what goes on under the hood.
"First, it turns out that you can't use header more than once for the same header"
...Yes you can:
"The optional replace parameter indicates whether the header should replace a previous similar header, or add a second header of the same type. By default it will replace, but if you pass in FALSE as the second argument you can force multiple headers of the same type. For example:"
Plus why are you sending the raw headers for cookies anyway? It's just re-inventing the wheel.
@Lewis: wow, I must be tired. I completely missed that.
Anyways, I wanted to send the raw header because, as I said in the post, I just wanted to passthrough the cookie calls from the other page. Using setcookie meant I had to break the cookies into name/value pairs. Had I looked closer, I could have avoided the whole mess.
Time for me to go to bed...
Ah so you just wanted to pass on the cookie headers you received? Sorry I missed that.
Nothing worse than spending ages on 1 tiny, annoying problem. I find it one of the most annoying things in developing because there's nothing you can do to get back those wasted hours and you end up with nothing to show for it. What's worse is when you find out how simple the fix was :P
I've tried to get better over the years about not getting so stressed out when this crap happens to me. I get so frustrated when something seems so simple and yet I'm getting stuck. I left work on Friday in the middle of one of these monster simple issues, and surprise, it's client side and involves IE.
Put this as first thing on your file "Nothing before it even a white space"
ob_start();
Put this as Last thing in page "Not thing after this at all "
ob_end_flush();
Of course between php open and close tags
This will solve the problem
in my application i always use one index file and put this in that file you can do this or but them in header and footer
what that exactly do is turn on some sort of buffer and will not send the header until all the page processed
I wish that help
Regards,
It's like the missing semicolons - there's always one floating somewhere...
Or the cast conversions (in C++ for me), but yeah, there's always some small piece of code or documentation that you're missing - I tried to develop without the internet recently and found it hard because I'm used to being able to read documentation online.
@Jonathon,
I too, completely missed that second parameter on header()... When in the heat of battle it can be a little hard to take a deep breath and read the manual =)
I remember back in the days when I started coding for the first time. Was so strange to why I can't do echo before header. The documentation helped a lot (as always).