close ad
Databridge V2 with MySQLi support IS Now Available!
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

voucher system to check if same code used before

Thread began 5/21/2012 1:30 pm by Christopher West | Last modified 5/24/2012 2:47 pm by Christopher West | 1660 views | 19 replies

Christopher WestCommunity Expert

voucher system to check if same code used before

Hi. just fine tuning a few bits to my website project.

with the voucher system I have in place, the voucher codes would always be single use since they are unique numbers (gift certificates sold to customers). on the confirm page i have an update transaction so that the voucher code the customer enters is then updated in the database as being "redeemed" and a customer reference ID and date is stored - so thats ok. But I just want to put some validation on the cart.php page (this is where the customer would enter the voucher code) so that if they try and use the same code again a message displays telling them that "voucher code has already been redeemed".

I am stuck to know how I could use form validation to check the state of a field in a table column in the database. IE the field in question "VoucherStatus" is either a "1" (redeemed) or a "0" (unused).

any thoughts how I can tackle this?

further to this problem, there is a logical problem in terms on the voucher status is updated on the confirm page (on page load). but what if the customer changes their mind and continues adding to the cart...if thye had reached the confirm page before this then then updated voucher code wont allow them to use it again (since the voucher status would have been updated on the confirm page)......I did think about putting the voucher update code on the "success" page (after customer goes to paypal to pay for order) but then this can be a problem, because what IF a customer uses a voucher code, then goes to paypal to pay for order BUT then closes their browser - this would mean the success page would never be reached and then the voucher code update will never take place since it would have been on that success page.

any thoughts appriciated on this to :)


Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question





Ease of use


security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...