jedimastermopar
11-22-2006, 09:07 PM
I have a form with 2 text boxes and a button that calls a php calculation and displays the result.
I want to have it so that if it returns a zero or a null it displays nothing
If the user leaves the text boxes blank the result of the php if statment returns the number 0.
If the user inputs 0's into the text boxes it returns nothing as expected
If the user inputs numbers it displays "value = 67.98"
I can't figure out where 0 is comming from as the if statement is not being fulfilled so it shouldn't be displaying anything.
Here is the code for the calculation
$item2tot = floatval ($POST['item2']) * floatval ($POST['qty2']);
Here is the code for the if statement
<?php if ($item2tot != '0'){ echo "value = $item2tot" ;} ?>
I want to have it so that if it returns a zero or a null it displays nothing
If the user leaves the text boxes blank the result of the php if statment returns the number 0.
If the user inputs 0's into the text boxes it returns nothing as expected
If the user inputs numbers it displays "value = 67.98"
I can't figure out where 0 is comming from as the if statement is not being fulfilled so it shouldn't be displaying anything.
Here is the code for the calculation
$item2tot = floatval ($POST['item2']) * floatval ($POST['qty2']);
Here is the code for the if statement
<?php if ($item2tot != '0'){ echo "value = $item2tot" ;} ?>