// Filters out input to return a currency value only. function numpass_filter($userString) { $money = explode(".", $userString); $dollars = eregi_replace("[^0-9]", null, $money[0]); $cents = eregi_replace("[^0-9]", null, $money[1]); if((string)$cents!=null) { $cents = "." . $cents; } $result = $dollars . $cents; return($result); } if ($_POST) { // validate form input $_POST['amount'] = numpass_filter($_POST['amount']); if (($_POST['type'] == 'donation') and !($_POST['amount'])) { $error = "Please enter a valid amount of money to donate."; } if ($_POST['type'] == 'app_fee') { $_POST['amount'] = '25'; } } if (($error) or (!$_POST)) { ?>