Received email link to pre-fill HTML form from database
We are setting up an email campaign, and would like to make it as easy as possible for those who opt-in to submit the form. If the email link has the originating email address appended to the URI, can I use PHP to connect to our database, search a table for the email address, and if found, pre-fill the HTML (PHP) form, so the customer only has to confirm/correct the information we already have, rather than enter it all.
Those who opt-in and select the link are requesting a complimentary item be mailed to them, so we will need to confirm their mailing address. When the form is submitted, it will need to write the information back to the database.
Is this a complex process? I believe the database is MySQL and I understand PHP and MySQL plan nice together, so how complicated a coding job is this project?
Thank you in advance for your time and consideration.
It wouldn't be very difficult. Just add the user's email address to the querystring. ie: email@example.com
A note on security: I would also include a unique key in the querystring: firstname.lastname@example.org&key=6a5sf6f87e5465dasf. Then compare that key to the one you have stored for the email address in your DB.
Otherwise, someone can go to promotion.php and try random email addresses (or known email addresses) and set any of your user's mailing details.