I am very new to php. I just started reading a book about it and they have examples scripts for you to write. I recently wrote one but I get an error that I have no idea what is wrong. The error I get is this:
Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/bc2013/public_html/handle_calc.php on line 16
The two scripts are:
1) The html page:
<DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<title>Product Cost Caculator</title>
</head>
<body>
Fill out this form to caculate the total cost:<br />
<form action="handle_calc.php" method="post">
Price: <input type="text" name="price" size="5" /> <br />
Quantity: <input type="text" name="quantity" size="5" /> <br />
Discount: <input type="text" name="discount" size="5" /> <br />
Tax: <input type="text" name="tax" size="3" /> <br />
Shipping method: <select name="shipping">
<option value="5.00"> Ground</option>
<option value="8.95"> Second day</option>
<option value="19.36"> Next day</option>
</select>
<br />
Number of payments to make: <input type="text" name="payments" size="3" />
<br />
<input type="submit" value="Calculate!" />
</form>
</body>
</html>
2) The php page:
<DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<title>Product cost</title>
</head>
<body>
<? //script 4.2 - handle_calc.php
ini_set ('display_errors', 1);
error_reporting (E_ALL & `E_NOTICE);
$price = $POST['price'];
$quantity = $POST['quantity'];
$discount = $POST['discount'];
$tax = $POST['tax'];
$shipping = $POST['shipping'];
$payments = $POST['payments'];
$total = $price * $quantity;
$total = $total + $shipping;
$total = $total - $discount;
$taxrate = $tax/100;
$taxrate = $taxrate + 1;
$total = $total * $taxrate;
$monthly = $total / $payments;
print "You have selected to purchase: <br />
<b>$quantity</b> widget(s) at <br />
$<b>$price</b> with a <br />
$<b>$shipping</b> cost and a <br/>
<b>$tax</b> percent tax rate.<br />
After your $<b>$discount</b> discount, the total cost is $<b>$total</b>.<br />
Divided over <b>$payments<b/> monthly payments, that would be $<b>$monthly</b> each.";
?>
</body>
</html>
If someone could please help that would be great. Thank you for your time.