function get_err($this_key){
global $err_array, $err;
if (@array_key_exists("$this_key", $err_array)) {
$err = "class=err";
// print_r($err_array);
}else{
$err = "";
}
return $err;
}
if ($submit){
if ($unit_price || $sold_by){
if ($unit_price==""){
$err_array[unit_price] = "Unit Price required if using Sold By value.";
}elseif(!is_numeric($unit_price)){
$err_array[unit_price] = "Unit Price must be numeric";
}
if ($sold_by==""){
$err_array[sold_by] = "Sold By required if using Unit Price value.";
}elseif(!is_numeric($sold_by)){
$err_array[sold_by] = "Sold By must be an integer.";
}
$mysum = $unit_price * $sold_by;
// $mysum = (float)$mysum;
// $price = (float)$price;
$getprice = gettype($price);
$getmysum = gettype($mysum);
if ($price != $mysum){
$err_array[unit_price] = "Unit Price X Sold By must = Price.
$unit_price * $sold_by = $mysum (mysum $getmysum) = $price (price $getprice). FAILED";
if (!array_key_exists("sold_by", $err_array)) { $err_array[sold_by] = ""; }
if (!array_key_exists("price", $err_array)) { $err_array[price] = ""; }
}
}
if (count($err_array) != 0){
print ("
Please correct the $err_count error(s):
");
while (list($index,$value) = each($err_array)){
print ("$value
");
}
print ("
Unit Price X Sold By DOES = Price.
$unit_price * $sold_by = $mysum (mysum $getmysum) = $price (price $getprice). WORKED!