Bboy
Новичок
Не получается корректно запустить...
Установил "Денвер" последнюю версию. Скопировал в папку Z:\home\localhost\www файл orderform.html со след. кодом:
<html>
<head>
<title>Bob's Auto Parts</title>
</head>
<body>
<h1>Bob's Auto Parts</h1>
<h2>Order Form</h2>
<form action="processorder.php" method=post>
<table border=0>
<tr bgcolor=#cccccc>
<td width=150>Item</td>
<td width=15>Quantity</td>
</tr>
<tr>
<td>Tyres</td>
<td align=center><input type="text" name="tyreqty" size=3 maxlength=3></td>
</tr>
<tr>
<td>Oil</td>
<td align=center><input type="text" name="oilqty" size=3 maxlength=3></td>
</tr>
<tr>
<td>Spark Plugs</td>
<td align=center><input type="text" name="sparkqty" size=3 maxlength=3></td>
</tr>
<tr>
<td colspan=2 align=center><input type=submit value="Submit Order"></td>
</tr>
</table>
</form>
</body>
</html>
и файл processorder.php с кодом:
<html>
<head>
<title>Bob's Auto Parts - Order Results</title>
</head>
<body>
<h1>Bob's Auto Parts</h1>
<h2>Order Results</h2>
<?
echo "<p>Order processed at "; // Start printing order
echo date("H:i, jS F");
echo "<br>";
echo "<p>Your order is as follows:";
echo "<br>";
echo $tyreqty." tyres<br>";
echo $oilqty." bottles of oil<br>";
echo $sparkqty." spark plugs<br>";
$totalqty = 0;
$totalamount = 0.00;
define("TYREPRICE", 100);
define("OILPRICE", 10);
define("SPARKPRICE", 4);
$totalqty = $tyreqty + $oilqty + $sparkqty;
$totalamount = $tyreqty * TYREPRICE
+ $oilqty * OILPRICE
+ $sparkqty * SPARKPRICE;
$totalamount = number_format($totalamount, 2);
echo "<br>\n";
echo "Items ordered: ".$totalqty."<br>\n";
echo "Subtotal: $".$totalamount."<br>\n";
$taxrate = 0.10; // local sales tax is 10%
$totalamount = $totalamount * (1 + $taxrate);
$totalamount = number_format($totalamount, 2);
echo "Total including tax: $".$totalamount."<br>\n";
?>
</body>
</html>
Затем запускаю orderform.html, заполняю поля, нажимаю кнопку и мне выводится вледующее:
Bob's Auto Parts
Order Results
"; echo $oilqty." bottles of oil
"; echo $sparkqty." spark plugs
"; $totalqty = 0; $totalamount = 0.00; define("TYREPRICE", 100); define("OILPRICE", 10); define("SPARKPRICE", 4); $totalqty = $tyreqty + $oilqty + $sparkqty; $totalamount = $tyreqty * TYREPRICE + $oilqty * OILPRICE + $sparkqty * SPARKPRICE; $totalamount = number_format($totalamount, 2); echo "
\n"; echo "Items ordered: ".$totalqty."
\n"; echo "Subtotal: $".$totalamount."
\n"; $taxrate = 0.10; // local sales tax is 10% $totalamount = $totalamount * (1 + $taxrate); $totalamount = number_format($totalamount, 2); echo "Total including tax: $".$totalamount."
\n"; ?>
Как сделать что бы все нормально было???????!!!!!!!!!!!!
Установил "Денвер" последнюю версию. Скопировал в папку Z:\home\localhost\www файл orderform.html со след. кодом:
<html>
<head>
<title>Bob's Auto Parts</title>
</head>
<body>
<h1>Bob's Auto Parts</h1>
<h2>Order Form</h2>
<form action="processorder.php" method=post>
<table border=0>
<tr bgcolor=#cccccc>
<td width=150>Item</td>
<td width=15>Quantity</td>
</tr>
<tr>
<td>Tyres</td>
<td align=center><input type="text" name="tyreqty" size=3 maxlength=3></td>
</tr>
<tr>
<td>Oil</td>
<td align=center><input type="text" name="oilqty" size=3 maxlength=3></td>
</tr>
<tr>
<td>Spark Plugs</td>
<td align=center><input type="text" name="sparkqty" size=3 maxlength=3></td>
</tr>
<tr>
<td colspan=2 align=center><input type=submit value="Submit Order"></td>
</tr>
</table>
</form>
</body>
</html>
и файл processorder.php с кодом:
<html>
<head>
<title>Bob's Auto Parts - Order Results</title>
</head>
<body>
<h1>Bob's Auto Parts</h1>
<h2>Order Results</h2>
<?
echo "<p>Order processed at "; // Start printing order
echo date("H:i, jS F");
echo "<br>";
echo "<p>Your order is as follows:";
echo "<br>";
echo $tyreqty." tyres<br>";
echo $oilqty." bottles of oil<br>";
echo $sparkqty." spark plugs<br>";
$totalqty = 0;
$totalamount = 0.00;
define("TYREPRICE", 100);
define("OILPRICE", 10);
define("SPARKPRICE", 4);
$totalqty = $tyreqty + $oilqty + $sparkqty;
$totalamount = $tyreqty * TYREPRICE
+ $oilqty * OILPRICE
+ $sparkqty * SPARKPRICE;
$totalamount = number_format($totalamount, 2);
echo "<br>\n";
echo "Items ordered: ".$totalqty."<br>\n";
echo "Subtotal: $".$totalamount."<br>\n";
$taxrate = 0.10; // local sales tax is 10%
$totalamount = $totalamount * (1 + $taxrate);
$totalamount = number_format($totalamount, 2);
echo "Total including tax: $".$totalamount."<br>\n";
?>
</body>
</html>
Затем запускаю orderform.html, заполняю поля, нажимаю кнопку и мне выводится вледующее:
Bob's Auto Parts
Order Results
"; echo $oilqty." bottles of oil
"; echo $sparkqty." spark plugs
"; $totalqty = 0; $totalamount = 0.00; define("TYREPRICE", 100); define("OILPRICE", 10); define("SPARKPRICE", 4); $totalqty = $tyreqty + $oilqty + $sparkqty; $totalamount = $tyreqty * TYREPRICE + $oilqty * OILPRICE + $sparkqty * SPARKPRICE; $totalamount = number_format($totalamount, 2); echo "
\n"; echo "Items ordered: ".$totalqty."
\n"; echo "Subtotal: $".$totalamount."
\n"; $taxrate = 0.10; // local sales tax is 10% $totalamount = $totalamount * (1 + $taxrate); $totalamount = number_format($totalamount, 2); echo "Total including tax: $".$totalamount."
\n"; ?>
Как сделать что бы все нормально было???????!!!!!!!!!!!!