Created
April 16, 2012 15:09
-
-
Save h4/2399368 to your computer and use it in GitHub Desktop.
Заказ и обработка товара
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html><head> | |
<title>Обработка заказа</title> | |
</head> | |
<body> | |
<h2>Обработка заказа</h2> | |
<?php | |
define("TYREPRICE", 100); | |
define("OILPRICE", 10); | |
define("SPARKPRICE", 4); | |
echo "<p>Заказ обработан: "; | |
$tyre = $_POST["tyreqty"]; | |
$oil = $_POST["oilqty"]; | |
$spark = $_POST["sparkqty"]; | |
echo date("H:i, j F"); | |
echo "<br>"; | |
echo "<p>Ваш заказ:"; | |
echo "<br>"; | |
$totalqty = 0; | |
$totalamount = 0.00; | |
$totalqty = $tyre + $oil + $spark; | |
echo $tyre." шт. шин по цене " . TYREPRICE . "руб. = " . number_format($tyre * TYREPRICE, 2) . " руб.<br>"; | |
echo $oil." бут. масла цене " . OILPRICE . "руб. = " . number_format($oil * OILPRICE, 2) . " руб.<br>"; | |
echo $spark." шт. свечей цене " . SPARKPRICE . "руб. = " . number_format($spark * SPARKPRICE, 2) . " руб.<br>"; | |
$totalamount = $tyre * TYREPRICE | |
+ $oil * OILPRICE | |
+ $spark * SPARKPRICE; $totalamount = number_format($totalamount, 2); | |
echo "<br>\n"; | |
echo "Сколько предметов заказано: ".$totalqty."<br>\n"; echo "Общая стоимость: $".$totalamount."<br>\n"; $taxrate = 0.10; // local sales tax is 10% | |
$totalamount = $totalamount * (1 + $taxrate); | |
$totalamount = number_format($totalamount, 2); | |
echo "Всего, включая налог: $".$totalamount; | |
?> | |
</body> | |
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<title>Заказ товара</title> </head> | |
<body> | |
<h2>Заказ товара</h2> | |
<form action="03_obrabotka.php" method="POST"> <table border=0> | |
<tr bgcolor=#cccccc> | |
<td width=150>Наименование</td> | |
<td width=15>Количество</td> | |
</tr> | |
<tr> <td>Шины</td> | |
<td align=center><input type="text" name="tyreqty" size=3 maxlength=3></td> | |
</tr> <tr> | |
<td>Масло</td> | |
<td align=center><input type="text" name="oilqty" size=3 maxlength=3></td> | |
</tr> | |
<tr> <td>Свечи</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="Заказать"></td> | |
</tr> | |
</table> | |
</form> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment