Link to home
Start Free TrialLog in
Avatar of vrmetro
vrmetroFlag for United States of America

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.
if (isset($_POST['amount']))
	{
	$_POST['amount']= ($_POST['amount']-'75.00');
	}

Open in new window

Avatar of Ray Paseur
Ray Paseur
Flag of United States of America image

You should remove the quotes from '75.00'
ASKER CERTIFIED SOLUTION
Avatar of Ray Paseur
Ray Paseur
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of vrmetro

ASKER

What does this part do?

ereg_replace("[^0-9\.\-]",
Avatar of vrmetro

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
Avatar of vrmetro

ASKER

thanks Ray, much appreciated.