Custom Form


#1

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!


#2

What platform is your site on? What email client are you using to send mails on? What CRM tool is being used?


#3

Thank you for getting back to me. I don’t need it to actually be integrated into the CRM. Preferring to do this with just PHP/MySQL independent of other CRM/eCommerce stuff.

Platform: Apache/Nginx
Email Client: phpmail()
CRM Tool: none, information doesn’t need to be cross referenced with any database of information.

Just looking to have a database of coupon codes that are inserted into mysql then have it be grabbed and inserted into a confirmation e-mail and have that coupon code tagged as “GIVEN” so it doesn’t get sent to any future form submissions. Hope this explains a bit more.


#4

I can think how to do it with some of the commerce platforms but don’t know of a stand alone script for this (although it probably would not be too hard to configure for someone who works in this field).

If you don’t want to integrate it necessarily could you set it up separately, even using something like WordPress and make it a separate process? There are a ton of plugins etc. that can do it like https://wordpress.org/plugins/voucherpress/


#5

Great idea. I took a quick glance (driving right now in traffic) but think that will allow me to provide a list of 5,000 vouchers to use? Because they are specific to platform we use. Definitely looks like a great start, thanks again!


#6

I’ve never tested the limit but it is worth checking out. There are several other plugins like it but this one is very straight forward.


#7

thanks again for your help. this does work but unfortunately the “voucher” is a downloadable file. I guess that could/would work fine but it has to grab it from wordpress which wouldn’t allow me to white-label/hide the wordpress portion. but it works though, ill need to figure out how to maybe have it feed the data into an e-mail instead of an attached voucher.


#8

There may be a better alternative out there - I’ll have a peek over the weekend but if it ticks 90% of the challenge then feeding that data to the mail or maybe some form of obfuscation on the WP side of things might help.

I’ve seen something similar done with mobiles recently but that might get a bit more complicated with setup and costs.

You can always check out studio.envato.com and see if you can find someone who is more familiar with this type of code to work it out esp. if you have a headstart in that plugin.

Good luck