once the session for the promo code is set it wont clear if you enter an invalid promo code.
Where you say it was working before and now it is not, i think the real problem is that you are not closing the browser between tests.
the code that sets the session:
<?php
if (!session_id()) session_start();
if(!($totalRows_rsCoupon == 0)) {
$_SESSION["PromoAmount"] = "".$row_rsCoupon['couponAmt'] ."";
}
?>
will only set it if the entered code is found in the database. If you resubmit a bad promo code, it wont clear the previous one. to clear the previous code, you need to close the browser completely between tests.
as for single use coupons:
You would need to add a PromoCode column to the orders table, then update the Store Order Summary behavior on the Confirm page to store the coupon that is used for the order.
you can then update the rsCouponCode recordset to use a joined query
SELECT * FROM daily_candy
WHERE couponCode
OUTER JOIN orders
ON daily_candy.couponCode = orders.couponCode
WHERE daily_candy.couponCode = paramCouponCode1 AND orders.couponCode <> paramCouponCode2
Parameters:
name:paramCouponCode1
Type: text
Default value: -1
Runtime Value = $_POST['txtPromoCode']
name:paramCouponCode2
Type: text
Default value: -1
Runtime Value = $_POST['txtPromoCode']
This will return the promo code only if it does not exist in the orders table already