vrmetro
asked on
reduce POST value by 75
Hello,
In the below code I am checking if a post value exists, if it does I want to reduce that amount by 75.00, is teh code below correct?
Thank you.
In the below code I am checking if a post value exists, if it does I want to reduce that amount by 75.00, is teh code below correct?
Thank you.
if (isset($_POST['amount']))
{
$_POST['amount']= ($_POST['amount']-'75.00');
}
You should remove the quotes from '75.00'
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
What does this part do?
ereg_replace("[^0-9\.\-]",
ereg_replace("[^0-9\.\-]",
ASKER
what does ereg_replace("[^0-9\.\-]", do?
Hi,vrmetro:Thanks for the points! That ereg statement discards everything except the numerals, the decimal point and the minus sign. You would not get a meaningful answer if $_POST had "$79.00" in the field - unless you made some edits to control for the kind of data that work with arithmetic. ~Ray
ASKER
thanks Ray, much appreciated.