setcookie issues
i was testing the script on my local webserver, and it worked great, it set the cookie just fine. then entire script was running smooth. well i upped it to my site and i found it was not setting the cookie. after about 3 hours of playing with it, ive learned that its not sending the set-cookie: header at all, BUT if i move the setcookie() to something before the first of the html tags(like before <html>) it will set the cookie fine. from what i can see, php is sending out the headers and info before it even parses the setcookie() line, which means its already too late to set the cookie since the headers have already gone out.
all i can guess is that this is some form of a bug in the older php on the webhosting i am using. php 4.4.4 is what is running on the webhosting. im running php 5.0.4 on my local server.
my question is, is this really a bug or some form of older php crud. and is there an easy way around this, since putting the setcookie() before all html tags would be a monumental pain in the butt, being there are about 20 echo's in various if's well before the setcookie() line.

