How to Create an Invoicing system in PHP
In this article, we will explain How to Create an Invoicing system in PHP. the invoice will be inserted into the database.
Example:-
form.php
<?php error_reporting( error_reporting() & ~E_NOTICE ); $item3=$_POST['item10']; $quantity3=$_POST['qty10']; $price3=$_POST['price10']; $item3=$_POST['item9']; $quantity3=$_POST['qty9']; $price3=$_POST['price9']; $vat=$_POST['vat']; $total=$_POST['total']; $grand=$_POST['grand']; $amount10=$_POST['amount10']; $amount9=$_POST['amount9']; $insert="insert into invoice set item10='$item10',qty10='$quantity10',price10='$price10',amount10='$amount10', item9='$item9',qty9='$quantity9',price9='$price9',amount9='$amount9', total='$total', vat='$vat', grand='$grand',bal='$grand'"; $result=mysql_query($insert); header("location:index.php"); } ?>
db.php
<?php mysql_connect('localhost','root',''); mysql_select_db('testbill'); ?>
index.php
<html> <head> <title>Invoicing System</title> </head> <body> <form method="POST"> <div class="row1"> <h4>Party Name</h4><input type="text" name="party_name" > </div> <thead> <tr> <td>Item </td> <td>Quantity</td> <td>Price</td> <td>Amount </td> <td></td> </tr> </thead> <tbody> <tr> <td> <td><input type="text" style="width:45px;" name="item8"/></td> <td><input type="text" name="qty10" style="width:45px;" value="<?php echo $quantity10 ;?>"/></td> <td><input type="text" name="price10" style="width:45px;" value="<?php echo $price10 ;?>"/></td> <td><input type="text" name="amount10" style="width:45px;" value="<?php echo $amount10 ;?>"/> </td> <td></td> </tr> <tr> <td> <td><input type="text" style="width:45px;" name="item8"/></td> <td><input type="text" name="qty9" style="width:45px;" value="<?php echo $quantity9 ;?>"/></td> <td><input type="text" name="price9" style="width:45px;" value="<?php echo $price9 ;?>"/></td> <td><input type="text" name="amount9" style="width:45px;" value="<?php echo $amount9 ;?>"/> </td> <td></td> </tr> <tr> <td colspan="3" align="right">Total</td> <td><input type="text" name="total" style="width:45px;" value="<?php echo $total;?>"/></td> <td></td> </tr> <tr> <td colspan="3" align="right" >Vat </td> <td> <select name="vat"> <option value=""></option> <option value="10" selected="selected">10</option></select></td> <td></td> </tr> <tr> <td colspan="3" align="right" >Grand Total</td> <td><input type="text" name="grand" style="width:45px;" value="<?php echo $grand;?>"/></td> <td></td> </tr> <tr> <td><input type="submit" name="cal" value="cal"/></td> <td><input type="submit" name="submit" value="save"/></td> <td></td><td></td><td></td> </tr> </tbody> </form> </body> </html>
Comments
Post a Comment