Hi folks,
I am a bit stuck with how to correctly format this if/else statement, I am still learning PHP.
I am trying to calculate the postage for a shopping cart. The state variable is stores in a session when the user logs in.
If the user is from QLD then I want to charge him a set range of postage prices based on how much the order total is, if he lives anywhere else (=! QLD) I want to charge different amount.
I came up with this, but I am sure it wont work:
// Calculate postage amount based on state
if ($_SESSION['state'] == QLD) {
if ($subtotal > 100) {
$PostalAmount = number_format( 5.00, 2);
}
if ($subtotal > 200) {
$PostalAmount = number_format( 10.00, 2);
}
if ($subtotal > 300) {
$PostalAmount = number_format( 15.00, 2);
}
elseif ($_SESSION['state'] != QLD) {
if ($subtotal > 100) {
$PostalAmount = number_format( 8.00, 2);
}
if ($subtotal > 200) {
$PostalAmount = number_format( 13.00, 2);
}
if ($subtotal > 300) {
$PostalAmount = number_format( 19.00, 2);
}
Any help would be GREATLY appreciated.