Soo, I guess the newsletters don’t work for some reason. At least, I couldn’t figure out how to get mine to send. I needed to offer coupons to my customers though, so I made a small PHP script and grabbed a couple java scripts to accomplish the task.
There’s three files here. The first is header_java. Open that, edit it to your liking, and put it in the header code of your template. This is what will be generating the popup window for the coupon page.
The second file is callout_java. This is the script that you will be putting in the body of your site, as a hyperlink for people to click on. The way it is formatted right now, it’s a hyperlink in the form of an image (like a coupon button). I put it in my right callout box, as it was easy to modify and always visible. It would work anywhere though.
The third file is the actual php script to generate the page and send the e-mails. Set up the configuration section and it should work just fine. It will pull the current active coupons from your database and send them in an e-mail to the entered address. There’s only one input, which is validated as an e-mail address, and a valid e-mail address.
I’m basically a newbie at this stuff, so if any experts see some kind of security vulnerability or other coding issue, please let me know. Any improvements would be greatly appreciated. I just made this for my own site, but figured some of you might get some use out of it as well.
Made a couple updates to coupon_form.php.