ok well a few issues...I have managed to get it working to an extent...but while testing came to a very odd bug... i am attaching the file in question in case there is something obvious....
the bug is: if i name a coupon with letters then the calculation comes back as the first first coupon value in the the database. if I name the coupon starting with a number then it seems to work..
in my database I have:
CouponCode VARCHAR(16) utf8_general_ci
the records I current have stored in the database are:
CouponID CouponCode CouponValue
14 b 0.98
15 10th 0.1
16 20th 0.2
17 half 0.5
18 30th 0.3
19 50th 0.5
20 you 0.5
21 66 0.5
22 5half 0.5