in reply to Re^2: Cookies write to screen, not to cookie file
in thread Cookies write to screen, not to cookie file

I need to collect the data before I can write it out.

Yes, that is true. However, this means that the user will have to click a link that sends the information or submit a form that sends the information before you can set a cookie.

You need some logic in your script that can detect whether the user already has a cookie, has just submitted data that you can use to set a cookie, or has no cookie or cookie-making data. Only then can you solve this problem.

Also keep in mind that you cannot set a cookie and read its values in the same invocation. I think this is what's confusing you most right here. CGI programming is rather like a conversation between two very polite people who never interrupt and wait for a complete response before answering back.

  • Comment on Re^3: Cookies write to screen, not to cookie file