Just a simple regular expression to test for a valid price - couldn't find an example on the net, so hth someone...
function isPrice($element) {
return !preg_match("/[0-9{1}[0-9]*.{1}[0-9]{2}$/",$element);
}
$result=isPrice($new_price);
if ($result == FALSE) {
$errMsg="This is not a valid price.";
}
else
// add $fuzz to force 0.5 to round upwards
$fuzz=0.00001;
$price=round(($new_price+$fuzz),2);
Jake