Hi. Hope everyone is having a great day. I’m not that savvy with MySQL/PHP integration but my little project I am trying to accomplish requires it. I have a PHP form using JS/AJAX which someone can enter information lets call it firstname, lastname, email & orderid. Once they enter this information and click the submit button I want an e-mail confirmation sent to them. I have this already created/generated and working fine.
Now for the tricky part, within this e-mail sent to them I need a coupon code that is unique. I have a list already of 5,000 unique coupon codes generated. I somehow need to make a MySQL table that will have all 5,000 unique coupon codes. When the form is filled out it will add the information to one of the coupon codes and not allow that same information to be used again. When the confirmation e-mail is sent out I need the associated coupon code to be within the confirmation e-mail.
Anyone able to help point me in the correct direction to do this? Thanks for your time!