Soldato
I've got an array that lists prices, and one is "0", ie free. The code checks if there's a discount later by checking the price, and obviously it reads 0 and therefore thinks there isn't a discount and charges full price.
Shortened code:
How can I pass this through as a number rather than it being seen as null? Thanks!
Shortened code:
PHP:
$postedcode = $_POST['code'];
$codelist = array("COUPONCODE" => "0");
$discountlist = array("50" => "SECRETCODE", "0" => "SECRETCODE2");
$discount = $codelist[$postedcode];
if(!$discount){
// charge full price
} else {
// charge discount price
}
How can I pass this through as a number rather than it being seen as null? Thanks!