Looking for some direction here. I added some code to an existing form and to the php script that handles the input from that form. I also added some code to work with these new variables. I have copied the piece of code (with a ton of prints to trace variables) and the debug printout below. The two problems are: ONE: The IF statement (if($retail2 < "10.00") does not compare the two values properly. I am pretty sure that if this one does not work, all the ones following do not work, but I never get that far. Please take a look at the debug prints after the code for the values going into the compare. SECOND: The multiplication statement at the end returns a value of 0. Do I have a problem with mixed mode expressions? The first IF works comparing a string with a real. The second if compares string to string and does not work. Even changing the "10.00" to 10.00 does not work. Thanks for any help, Klaus Cook Houston, Texas SECTION OF CODE: $cost2 = $record["my_price"]; $retail2 = $record["catalog_price"]; $markup2 = $record["markup"]; echo "before IF test<br>"; print_r ($markup2 ."<br>"); print_r ($retail2 ."<br>"); print_r ($cost2 ."<br>"); echo "during IF test<br>"; if ($markup2 == 0.00) { if($retail2 < "10.00") { echo $retail2 ." =1<br>"; $markup2 = 3.0; } if ($retail2 >="10" && $retail2 <"15") { echo $retail2 ." =2<br>"; $markup2 = 2.7; } if ($retail2 >= "15.00" && $retail2 < "20.00") { echo $retail2 ." =3<br>"; $markup2 = 2.5; } if ($retail2 >= "20.00" && $retail2 < "25.00") { echo $retail2 ." =4<br>"; $markup2 = 2.3; } if ($retail2 >= "25.00" && $retail2 < "35.00") { echo $retail2 ." =5<br>"; $markup2 = 2.1; } if ($retail2 >= "35.00" && $retail2 < "40.00") { echo $retail2 ." =6<br>"; $markup = 2.0; } if($retail2 >= 40.00) { echo $retail2 ." =7<br>"; $markup2 = 1.8; } } echo "before multiply<br>"; print_r ($markup2 ."<br>"); print_r ($cost2 ."<br>"); $price2 = $cost2*$markup2; echo "after multiply<br>"; print_r ($markup2 ."<br>"); print_r ($price2 ."<br>"); print_r ($retail2 ."<br>"); print_r ($cost2 ."<br>"); DEBUG PRINTOUT before IF test '0.00' '123.00' '55.01' during IF test '123.00' =1 before multiply 3 '55.01' after multiply 3 0 '123.00' '55.01'
but first please remove all of the "" around numbers; it is wrong; if ($retail2 >="10" && $retail2 <"15") { should be if ($retail2 >=10 && $retail2 <15) { told you in previous post about this also.
Thanks for the reply, but that is the way I had to code originally. I just changed all of them back to "without quotes", and the result is the same. I just can't understand why the variables have the correct values, but the test in the "IF statement" is not working. It kicks out on the first compare. Obviously 123.0 is not less than 10. Thanks, Klaus
but you did try; if ($markup2 == 0.00) { if($retail2 < 10.00) { echo $retail2 ." =1<br>"; $markup2 = 3.0; } because that really works...