Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => General

Setting cookies and writing to a db

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

Setting cookies and writing to a db

Postby mpgalvin » Sun Jun 29, 2003 6:56 am

I have a little problem in that I'd like to save some information to a database and also save some info to the user's h/d in a cookie. The problem is that I can't save cookies after headers have been sent, and after the db has been written, I'd like to show a thankyou message, so I need to send headers sometime before this.

save to cookie
show header
write to db
"thanks"

But after I write to the cookie, the processing on that php file will just stop - is there anything I can do here?
mpgalvin
New php-forum User
New php-forum User
 
Posts: 12
Joined: Sun Jan 12, 2003 2:53 am

Postby liquedus » Sun Jun 29, 2003 7:43 am

thats no good, could you perhaps post some code?
liquedus
php-forum Active User
php-forum Active User
 
Posts: 266
Joined: Tue Apr 08, 2003 5:18 am
Location: Ottawa, Canada

Postby mpgalvin » Sun Jun 29, 2003 2:57 pm

Yeah, that would have made things a lot clearer, wouldn't it. However, my initial premise that I couldn't do anything after setting a cookie was false - I can do whatever I like as long as the cookie is set before any headers are sent.

So, no problem. Apologies for wasting people's time (esp. liquedus)
mpgalvin
New php-forum User
New php-forum User
 
Posts: 12
Joined: Sun Jan 12, 2003 2:53 am


Return to PHP coding => General

Who is online

Users browsing this forum: Google [Bot], Google Feedfetcher and 2 guests

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.