a1setc1.html
<html>
<body>
<form method="post" action="a1setc1.php">
Enter Item Code :
<input type="text" name="code" value=" "><br>
Enter Item Name :
<input type="text" name="name" value=" "><br>
Enter Units Sold :
<input type="text" name="sold" value=" "><br>
Enter Item rate:
<input type="text" name="rate" value=" "><br>
<input type='submit' name='submit' value='submit'>
</form>
</body>
</html>
a1setc1.php
<?php
$c=$_POST['code'];
$n=$_POST['name'];
$s=$_POST['sold'];
$r=$_POST['rate'];
$code=explode(" ",$c);
$name=explode(" ",$n);
$sold=explode(" ",$s);
$rate=explode(" ",$r);
echo "<table border=2>";
echo "<tr><th>Item Code<th>Item Name<th>Units Sold<th>Item Rate</th></tr>";
$sum=0.0;
for($i=0;$i<count($rate);$i++)
{
echo "<tr>";
echo "<td>$code[$i]</td>";
echo "<td>$name[$i]</td>";
echo "<td>$sold[$i]</td>";
echo "<td>$rate[$i]</td>";
echo "</tr>";
$sum=$sum+($sold[$i]*$rate[$i]);
}
echo "Total Bill :$sum";
?>
0 Comments
If anyone has Doubts or suggestions please let me know