You are on page 1of 2

Part A Programm.

- Program to generate a BILL

<html>

<head>

</head>

<body>

<?php

if(!isset($_POST['bill']))

$item_list = array("Pen"=>25, "Pencil"=>20, "Book"=>56, "Chart Paper"=>10, "Color Pen "=>18);

?>

<form method=post action=bill.php >

<select name="item">

<?php

foreach($item_list as $item_name=>$item_price )

?>

<option value="<?php echo $item_price.",".$item_name ; ?>" > <?php echo $item_name ; ?> </option>

<?php

?>

</select>

Quantity <input type=number name=qty >

<input type=submit name=bill value=BILL >

</form>

<?php

}
else

$item=$_POST['item'];

$q=$_POST['qty'];

$itemdetails=explode(",",$item);

$name=$itemdetails[1];

$price=$itemdetails[0];

?>

<table>

<tr > <th colspan=4 > ABC Stationaries </th></tr>

<tr><th> Item Name <th>Item Price <th> Quantity<th>Total</tr>

<tr><td> <?php echo $name; ?> <td> <?php echo "Rs.. ".$price; ?> <td> <?php echo $q ; ?> <td><?php echo "Rs.. ". $q
* $price ?> </tr>

</table>

<?php

?>

</body>

</html>

You might also like