How to Make Fees Receipt in PHP Using Mysql Database

How to Make Fees Receipt in PHP Using Mysql Database

In this article, you will learn How to Make Fees Receipt in PHP Using Mysql Database.

index.php

<html>
<title>Add fees</title>
</head>
<body>
<h1><a href="add.php">Add receipt</a> &nbsp &nbsp &nbsp  <a href="search.php">Record</a></h1>
<form method="POST"
oninput="x.value=parseInt(a.value)+parseInt(b.value)+parseInt(c.value)" action="fees.php">
  <input type="date" name="date"><br/><br/>
  Name
  <input type="text" name="name"><br/><br/>
  Registration No.
  <input type="number" name="rno"><br/><br/>
  Course
  <select name="course">
  <option>Select Course</option>
  <option value="PHP">PHP</option>
  <option value="JAVA">JAVA</option>
  <option value="ACCOUNTS">ACCOUNTS</option>
  <option value="BASIC">BASIC</option>
  <option value="GRAPHIC DESIGNING">GRAPHIC DESIGNING</option>
  </select><br/><br/>
  Cash/Cheque/Draft
  <select name="type">
  <option value="Cash">Cash</option>
  <option value="Cheque">Cheque</option>
  <option value="Draft">Draft</option>
  </select><br/><br/>
  Cheque/Draft No.
  <input type="number" name="cno"><br/><br/>
  Cheque/Draft Date
  <input type="date" name="cdate"><br/><br/>
  Programme Fees
  <input type="number" placeholder="0" id="a" name="a"><br/><br/>
  Late Fees
  <input type="number" placeholder="0" id="b" name="b"><br/><br/>
  Other Fees
  <input type="number" placeholder="0" id="c" name="c"><br/><br/>
  Balance
  <input type="number" placeholder="0" id="c" name="bal"><br/><br/>
  Total
  <input name="x" for="a b c" />
  <br><br>
  <input type="submit" name="submit">
</form>


</body>
</html>

fees.php

<?php
include(fees.php);
if(isset($_POST['submit'])=='submit')
{
$date=$_POST['date'];
$name=$_POST['name'];
$rno=$_POST['rno'];
$course=$_POST['course'];
$type=$_POST['type'];
$cno=$_POST['cno'];
$cdate=$_POST['cdate'];
$a=$_POST['a'];
$b=$_POST['b'];
$c=$_POST['c'];
$bal=$_POST['bal'];
$x=$_POST['x'];
$insert="insert into fees set date='$date',name='$name',rno='$rno',
course='$course',type='$type',cno='$cno',cdate='$cdate',
a='$a',b='$b',c='$c',bal='$bal',total='$x'";
$query=mysql_query($insert);
}
?>

db.php

<?php
mysql_connect('localhost','root','');
mysql_select_db('fees');
?>

Leave A Reply