The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End php poll page hrlp … Reply To: php poll page hrlp …


please, do not “dump” code.

Show us the relevant parts. If you’re not sure, describe the problem as clearly as possible, and link to the code elsewhere (e.g., make a gist on github).

when I try to set the cookie, it says errors with headers already sent

Have you done any research yet? It’s a very common problem. I’m sure you could find hundreds of answers on google just by copy+pasting the message.

There are two parts to a HTTP response: the headers, and the body. (Not to be confused with the <head> and <body> of an HTML document.) Cookies are a type of HTTP header. The headers must be sent first:. this means as soon as you send regular output (which goes in the body), the headers must be sent, and you can’t send any more afterwards. Any output counts, even (for example) whitespace or a BOM.