PHP program for supermarket.

CODING:

supermarket.html:

<html>
<head></head>
<form action="supermarket.php" method="REQUEST">
<h1>
<center><font color="red">super market</font></h1>
<br>

<table>
<tr><td><input type="checkbox" name="n1" value="himalaya">
Himalaya
</td></tr>

<td><select name="p1">
<option>15</option><option>35</option>
</select></td></tr>
<tr><td>

<input type="text" name="q1">
</td></tr>

<tr><td>
<input type="checkbox" name="n2" value="vasline">vasline</td></tr>
<td>
<select name="p2">
<option>90</option><option>175</option></select>
<tr><td><input type="text" name="q2">
</td></tr>


<tr><td><input type="checkbox" name="n3" value="ponds">ponds
</td></tr>

<td><select name="p3">
<option>15</option><option>35</option>
</select>
<tr><td><input type="text" name="q3"></td></tr>

<tr><td><input type="submit"  value="totamt"></td></tr>
</table>
</center>
</form>
</body>
<html>

supermarket.php:  

<?php
$n1=$_REQUEST['n1'];
$n2=$_REQUEST['n2'];
$n3=$_REQUEST['n3'];
$p1=$_REQUEST['p1'];
$p2=$_REQUEST['p2'];
$p3=$_REQUEST['p3'];
$q1=$_REQUEST['q1'];
$q2=$_REQUEST['q2'];
$q3=$_REQUEST['q3'];
echo "<center><font color=blue><b>Your select product</font></b></center>";
echo "<br><br>";
echo "<center><table border=2><tr><th>PRODUCT</th>
<th>PRICE</th>
<th>QUANTITY</th>
<th>AMOUNT</th></tr>";
if($n1==true)
{
$a1=$q1*$p1;
echo "<tr><td>".$n1."<td>".$p1."<td>".$q1."<td>".$a1."</tr>";
}
if($n2==true)
{
$a2=$q2*$p2;
echo "<tr><td>".$n2."<td>".$p2."<td>".$q2."<td>".$a2."</tr>";
}
if($n3==true)
{
$a3=$q3*$p3;
echo "<tr><td>".$n3."<td>".$p3."<td>".$q3."<td>".$a3."</tr>";
}
$totamt=$a1+$a2+$a3;
echo "<tr><td colspan=4>total amount:"."Rs".$totamt."</tr></center></table>";
?>

OUTPUT:



Comments

POPULAR POSTS

POPULAR POSTS