display_discount.php
<?php
// get the data from the form
$product_description = $_POST['product_description'];
$list_price = $_POST['list_price'];
$discount_percent = $_POST['discount_percent'];
// calculate the discount
$discount = $list_price * $discount_percent * .01;
$discount_price = $list_price - $discount;
// apply currency formatting to the dollar and percent amounts
$list_price_formatted = "Rs.".number_format($list_price, 2);
$discount_percent_formatted = $discount_percent."%";
$discount_formatted = "Rs.".number_format($discount, 2);
$discount_price_formatted = "Rs.".number_format($discount_price, 2);
?>
<!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>
<title>Product Discount Calculator</title>
<link rel="stylesheet" type="text/css" href="main.css" />
</head>
<body>
<div id="content">
<h1>Product Discount Calculator</h1>
<label>Product Description:</label>
<span><?php echo $product_description; ?></span><br/>
<label>List Price:</label>
<span><?php echo $list_price_formatted; ?></span><br />
<label>Standard Discount:</label>
<span><?php echo $discount_percent_formatted; ?></span><br />
<label>Discount Amount:</label>
<span><?php echo $discount_formatted; ?></span><br />
<label>Discount Price:</label>
<span><?php echo $discount_price_formatted; ?></span><br />
<p> </p>
Authorised Signature :-- <i>TechNode Computer</i>
</div>
</body>
</html>
// get the data from the form
$product_description = $_POST['product_description'];
$list_price = $_POST['list_price'];
$discount_percent = $_POST['discount_percent'];
// calculate the discount
$discount = $list_price * $discount_percent * .01;
$discount_price = $list_price - $discount;
// apply currency formatting to the dollar and percent amounts
$list_price_formatted = "Rs.".number_format($list_price, 2);
$discount_percent_formatted = $discount_percent."%";
$discount_formatted = "Rs.".number_format($discount, 2);
$discount_price_formatted = "Rs.".number_format($discount_price, 2);
?>
<!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>
<title>Product Discount Calculator</title>
<link rel="stylesheet" type="text/css" href="main.css" />
</head>
<body>
<div id="content">
<h1>Product Discount Calculator</h1>
<label>Product Description:</label>
<span><?php echo $product_description; ?></span><br/>
<label>List Price:</label>
<span><?php echo $list_price_formatted; ?></span><br />
<label>Standard Discount:</label>
<span><?php echo $discount_percent_formatted; ?></span><br />
<label>Discount Amount:</label>
<span><?php echo $discount_formatted; ?></span><br />
<label>Discount Price:</label>
<span><?php echo $discount_price_formatted; ?></span><br />
<p> </p>
Authorised Signature :-- <i>TechNode Computer</i>
</div>
</body>
</html>
index.php
<!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>
<title>Product Discount Calculator</title>
<link rel="stylesheet" type="text/css" href="main.css" />
</head>
<body>
<div id="content">
<h1>Product Discount Calculator</h1>
<form action="display_discount.php" method="post">
<div id="data">
<label>Product Description:</label>
<input type="text" name="product_description"/><br />
<label>List Price:</label>
<input type="text" name="list_price"/><br />
<label>Discount Percent:</label>
<input type="text" name="discount_percent"/>%<br />
</div>
<div id="buttons">
<label> </label>
<input type="submit" value="Calculate Discount" /><br />
</div>
</form>
</div>
</body>
</html>
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Product Discount Calculator</title>
<link rel="stylesheet" type="text/css" href="main.css" />
</head>
<body>
<div id="content">
<h1>Product Discount Calculator</h1>
<form action="display_discount.php" method="post">
<div id="data">
<label>Product Description:</label>
<input type="text" name="product_description"/><br />
<label>List Price:</label>
<input type="text" name="list_price"/><br />
<label>Discount Percent:</label>
<input type="text" name="discount_percent"/>%<br />
</div>
<div id="buttons">
<label> </label>
<input type="submit" value="Calculate Discount" /><br />
</div>
</form>
</div>
</body>
</html>
main.css
body {
font-family: Arial, Helvetica, sans-serif;
}
#content {
width: 450px;
margin: 0 auto;
padding: 20px 20px;
background: white;
border: 2px solid navy;
}
h1 {
margin-top: 0;
color: navy;
}
label {
width: 10em;
padding-right: 1em;
float: left;
}
#data input {
float: left;
width: 15em;
margin-bottom: .5em;
}
#buttons input {
float: left;
margin-bottom: .5em;
}
br {
clear: left;
}
Result:
font-family: Arial, Helvetica, sans-serif;
}
#content {
width: 450px;
margin: 0 auto;
padding: 20px 20px;
background: white;
border: 2px solid navy;
}
h1 {
margin-top: 0;
color: navy;
}
label {
width: 10em;
padding-right: 1em;
float: left;
}
#data input {
float: left;
width: 15em;
margin-bottom: .5em;
}
#buttons input {
float: left;
margin-bottom: .5em;
}
br {
clear: left;
}
Result:
No comments:
Post a Comment