Using values from form for cookies and db
Posted: Thu May 20, 2004 2:16 am
I have a form on my site, one section of the form contains user details (name, address, etc) Once submitted I need the data from the form to be inserted into a table but also a cookie to be set. I know how to get the values into the database, but the problem I'm having is setting a cookie with a value and submitting the values to the database. The reason I want a cookie is so that when users return to the page with the form, their contact details will already be populated. There is no login system (and I don't want one) thus I need the cookie.
Am I missing something? The problem I see is that when submitting the form to the database I then need to send the user to another page, which is why I can't work out how to set the cookie for the previous (form) page. Can I set a cookie with values and submit them to a database at the same time? Ideally I'd like to call the cookie at the top of the (form) page, use that cookie's value to send a query to the database for the users contact details and populate the form boxes with that information. I know the code for all the database side of things, just not sure how to incorporate a cookie into it. Hope I've made some kind of sense, it's pretty hard to describe, any help would be appreciated, thankyou.
Steve.
Am I missing something? The problem I see is that when submitting the form to the database I then need to send the user to another page, which is why I can't work out how to set the cookie for the previous (form) page. Can I set a cookie with values and submit them to a database at the same time? Ideally I'd like to call the cookie at the top of the (form) page, use that cookie's value to send a query to the database for the users contact details and populate the form boxes with that information. I know the code for all the database side of things, just not sure how to incorporate a cookie into it. Hope I've made some kind of sense, it's pretty hard to describe, any help would be appreciated, thankyou.
Steve.