The basic idea is to have a form element that the user enters the coupon code into.
on submitting the coupon code, you look it up in the database using a recordset.
to add the ability to turn it on or off, you would add an additional where cause to the recordset to check that the coupon is enabled.
Then, if the recordset is not empty (Or in other words, the coupon code matches a record in the table and it;s record does not have the on / off column set to 0) then set the coupon amount session which is used in the discount rule.