Problem with IF statements


Hello. I am the same person who was asking questions on the PHP form emailer script. However, since I have that fixed, I have been experiementing with new things such as adding tax for only the state that I live in (law) and automatically calculating total cost in the form. I figured out the total cost. However…my tax calculator is not working, well it is, however it is adding tax for all states and not just WI. My script below SHOULD only calculate tax if the state is WI but it is not working? Is there something wrong with my IF statement?

		$Total_Cost = $_POST['Repair_Cost'] + $_POST['Mod_Cost'] + $_POST['Shipping_Handling'] + 10;
		if($_POST['State'] = 'WI'){ $Total_Cost = $Total_Cost + 0.055 * $Total_Cost; }
else {
		$Total_Cost = $_POST['Repair_Cost'] + $_POST['Mod_Cost'] + $_POST['Shipping_Handling'];
		if($_POST['State'] = 'WI'){ $Total_Cost = $Total_Cost + 0.055 * $Total_Cost; }


If thing I can see you are doing wrong is when using only a single equal sign.

Try == which is the equivilant to saying equal to. Where as = is like saying equals.

So your if statement should look something like.

if($_POST[‘State’] == ‘WI’){
$Total_Cost = $Total_Cost + 0.055 * $Total_Cost;


thanks! it worked!!