jakebur01 Posted June 4, 2007 Share Posted June 4, 2007 hey... I am getting 5.99 back as my shipping every time. I am missing something, I cannot figure out what it is. No matter what the $t_number is... it is returning 5.99.. <?php function calculate_shipping_cost() { // return 20.00; $t_number = number_format($_SESSION['total_price'],2); if ($t_number >= 0.01 and $number <= 14.99) { return 5.99; } else if ($t_number >= 15.00 and $number <= 29.99) { return 8.99; } else if ($t_number >= 30.00 and $number <= 49.99) { return 10.99; } else if ($t_number >= 50.00 and $number <= 74.99) { return 12.99; } else if ($t_number >= 75.00 and $number <= 99.99) { return 14.99; } else if ($t_number >= 100.00 and $number <= 149.99) { return 16.99; } else if ($t_number >= 150.00 and $number <= 199.99) { return 18.99; } else if ($t_number >= 200.00 and $number <= 299.99) { return 21.99; } else if ($t_number >= 300.00) { return 28.99; } else { return 10.00; } } Link to comment https://forums.phpfreaks.com/topic/54188-solved-shipping-calculation-trouble-with-if-statement/ Share on other sites More sharing options...
kael.shipman Posted June 4, 2007 Share Posted June 4, 2007 Try switching $number in the second part of each if statement to $t_number [obnoxious internet smiley-face here]. Link to comment https://forums.phpfreaks.com/topic/54188-solved-shipping-calculation-trouble-with-if-statement/#findComment-267908 Share on other sites More sharing options...
jakebur01 Posted June 4, 2007 Author Share Posted June 4, 2007 yea,,, sorry.... thanks Link to comment https://forums.phpfreaks.com/topic/54188-solved-shipping-calculation-trouble-with-if-statement/#findComment-267910 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.