<html>
<head>
<title>Book Store</title>
</head>
<body>
<table border="1">
<tr>
<th>Product</th>
<th>Price Per Piece</th>
</tr>
<tr>
<td>Book</td>
<td>20</td>
</tr>
<tr>
<td>Pencil</td>
<td>10</td>
</tr>
<tr>
<td>Pen</td>
<td>5</td>
</tr>
</table>
<form method="POST" action="processedform.php"
>
<table>
<tr bgcolor="red">
<td width="150">Product</td>
<td width="70">Quantity</td>
</tr>
<tr>
<td width="150">Book</td>
<td width="70"><input
type="text" size="3" name="book"></td>
</tr>
<tr>
<td width="150">Pencil</td>
<td width="70"><input
type="text" size="3" name="pencil"></td>
</tr>
<tr>
<td width="150">Pen</td>
<td width="70"><input
type="text" size="3" name="pen"></td>
</tr>
<tr>
<td width="150">How do you Find Anika
Stationary</td>
<td width="70">
<select name="find">
<option value="a">I am a regular
Customer</option>
<option value="b">TV
Advertising</option>
<option value="c">Phone
Directory</option>
<option value="d">Word of
mouth</option>
</select>
</td>
</tr>
<tr colspan="2">
<td align="center"><input
type="submit" value="submit order"
name="submit"></td>
</tr>
</table>
</form>
</body>
</html>
<?php
if(isset($_POST['submit']))
{
$book=$_POST['book'];
$pencil=$_POST['pencil'];
$pen=$_POST['pen'];
$find=$_POST['find'];
}
?>
<html>
<head>
<title>Form Proceed</title>
<link rel ="stylesheet"
href="order.css">
</head>
<body>
<h1>Anika Stationery</h1>
<h2>Order result</h2>
<?php
$book=$_POST['book'];
$pencil=$_POST['pencil'];
$pen=$_POST['pen'];
$find=$_POST['find'];
if($find=="a")
echo
"<mark>Regular Customer</mark>";
elseif($find=="b")
echo "<span
style='color:blue'>Customer Refer by TV advertisment</span>";
elseif($find=="c")
echo "<p
style='color:green'>Customer refered by Phone directory</p>";
elseif($find=="d")
echo
"<p>Customer refered by word of mouth</p>";
echo "<br> order Proceed at ";
date_default_timezone_set('Asia/Kolkata');
echo date("l jS \of F Y h:i:s A");
echo "<br>Your Order List as
follow:<br>";
echo "book: $book";
echo nl2br("\n pencil: $pencil");
echo "<br> pen: $pen<br>";
define('bookprice',20);
define('pencileprice',10);
define('penprice',5);
?>
<html>
<body >
<table border="1">
<tr>
<th>Product</th>
<th>Price Per Piece</th>
<th>Ordered Piece</th>
<th>Amount</th>
</tr>
<tr>
<td>Book</td>
<td>20</td>
<td><?php $book;
if($book==0)
{
echo "<font color='red'>";
echo 0;
echo "</font>";
}
else
echo $book;
?>
</td>
<td
><?php
$cob=$book*bookprice;
if($cob==0)
{
echo "<font color='red'>";
echo $cob;
echo "</font>";
}
else
echo $cob;
?>
</td>
</tr>
<tr>
<td>Pencil</td>
<td>10</td>
<td><?php $pencil;
if($pencil==0)
{
echo "<font color='red'>";
echo 0;
echo "</font>";
}
else
echo $pencil;
?>
</td>
<td><?php $copncl=$pencil*pencileprice;
if($copncl==0)
{
echo "<font color='red'>";
echo $copncl;
echo "</font>";
}
else
echo $copncl;
?></td>
</tr>
<tr>
<td>Pen</td>
<td>5</td>
<td><?php $pen;
if($pen==0)
{
echo "<font color='red'>";
echo 0;
echo "</font>";
}
else
echo $pen;
?>
</td>
<td><?php $copn=$pen*penprice;
if($copn==0)
{
echo "<font color='red'>";
echo $copn;
echo "</font>";
}
else
echo $copn;
?></td>
</tr>
<?php
$total=$cob+$copncl+$copn;
if($total==0)
{
echo
"<font color='red'>";
echo "you did not order anything ";
echo "<font>";
}
else
echo
"<font color='blue'>";
echo "you
ordered";
echo
"<font>";
?>
<tr>
<td colspan="3">Sub Total Amount</td>
<td><?php echo $total; ?></td>
</tr>
<tr>
<?php
define('txt',0.10);
?>
<td colspan="3"> Total Amount with 10%
tax</td>
<td><?php echo $total=$total*(1+ txt);
?></td>
</tr>
</table>
<?php
if ($total<100)
echo "There
is no gift below Purchasing of Rs. 100 ";
elseif($total>=100 && $total<=300)
echo "You worth 50 of Rs. Voucher";
elseif($total>300)
echo "You worth of 100 Rs. Voucher";
?>
</body>
</html>
Order.css
p
{
color:brown;
}
No comments:
Post a Comment