create a recordset that queries the coupon table for the entered coupon, and checks that the VoucherStatus is = to 0.
one of the variables created by the recordset will be the total rows returned:
$totalRows_recordsetName
where recordsetName is the name of the recordset.
in the server validation behavior, you can use numeric validation to make sure the recordset is empty. Select numeric validation, and enter:
$totalRows_recordsetName
for the server variable. Set the minimum to -1 and the maximum to 0
this will pass validation only of the recordset ins empty.
It sounds like you are using Paypal standard. With paypal standard, you should be using an IPN page to update order information on a successful transaction. the update for the coupon status should happen on the IPN page.