Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

double opt in

Status
Not open for further replies.

derwent

Programmer
May 5, 2004
428
GB
I want to create a newsletter script that asks for the users email, they they receive an email with a link to click to confirm that they really want the newsletter.

How is the best way to go about this. I was thinking of

user completes form
script to add email, name, ID (unique as it goes into DB) etc to DB
look for last DB entry (should be the one above) and grab ID key
send user email with link containing id key
user clicks link and it updates a flag in DB to confirm double opt in

Is that the best way to do it or is there a better way? If that`s the one I should go for, is it easy to grab the last entry from a SQL server db?

Thanks
 
Thats seems fine, although I would suggest you write a stored procedure that takes all of the data writes the record and returns you the id.

That way it is all in one transaction and you won't run the risk of getting the wrong ID when two are added simultaneously.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top