Forum Moderators: coopster
$a = $_POST["a"];
$b = $_POST["b"];
// I'll just include two sets to give you an idea, but there will be several to check against, each four lines long
$in_01 = "test1"; // $a
$ip_01 = "1234"; // $b
$ia_01 = "200.00"; // return value
$tf_01 = "2.9"; // computational value
$in_02 = "test2"; // $a
$ip_02 = "1234"; // $b
$ia_02 = "400.00"; // return value
$tf_02 = "2.9"; // computational value
// Computation, I'll just include it for one set, repeats the same for all sets
$tp_01 = $ia_01*$tf_01/100; // return value * computational value
$tft_01 = round($tp_01,2); // simply formats the above computation to two decimal places
$total_01 = $ia_01+$tp_01; // return value + the computed value from two lines ago
$to_01 = round($total_01,2); // simply formats the above computation to two decimal places
// basically, if a and b match correctly, echo a few values (return value, computational value, and then the two computed values to two decimal places)
if ($a == $in_01 && $p == $ip_01) {echo "$ia_01, $tf_01, $tft_01, $to_01";} // set 01
elseif ($a == $in_02 && $p == $ip_02) {echo "$ia_02, $tf_02, $tft_02, $to_02";} // set 02
else {echo "error message";}
200.00, 2.9, 5.80, 205.80