Simple Online Absent Form with PHP

Hello guys,finally I can post here again.Alhamdulillah I’ve done National Examination with happiness,thanks for pray all 🙂

It’s so long I haven’t posted again about computer,and now,I’ll post again 🙂

This post is about how to make simple online absent form with PHP,you can see in your school,your university,or more of it,usually you fill your name,your class,and you can go to your class,or if you get late,you can’t go to your school.

Okay,this is it ! 🙂

You’ll need


You need database to save data about the name of students,or the class of students,the time class now,and lot again.

The name of mine is absen,with one table named data,you can name it with the name do you want.

2.File Connection


/* This is connection file
 *It's to make detail about user,password,database,and to connect it.
$user="root"; /* In the localhost like WAMPP and XAMPP,the user default is 'root' */
$password=""; /*Blank the password */
$dbase="absen"; /* Set database that have we maked early */
$host="localhost"; /* The host is local */

/* Connection host,username,and password to server */

mysql_connect($host,$user,$pass) or die("Connection Failed !");

/* Database Selection */

mysql_select_db($dbase) or die("Database not found");


3.Configuration File


/* Set definition absent */

$school="Sekolah Ceria"; /*You can replace it with your school name*/
$time="07:00:00"; /*This is school time to begin studying */

/* Set time */

date_default_timezone_set('Asia/Jakarta'); /*Set time to local country*/
$hour=date(h:i:s); /*Set hour */
$dte=date("d"); /*Set date*/
$month=date("m"); /*Set month*/
$year=date("Y"); /*Set Year*/



4.Absent Form


include "config.php"; /*Include data of file config.php in your absent form */

/*Make form*/

echo "
<h2>Welcome in $school,let's fill your absent !</h2>
<p>Now is <b>$dte-$month-$year</b>,<b>$hour</b> o'clock.</p>
<form method=POST action=input.php>
<table border=1>
<tr><td>Name</td><td> : <input type=text name='nme'></td></tr>
<tr><td>Class</td><td> : <input type=text name='class'></td></tr>
<tr><td>Your School Number</td><td> : <input type=text name='num'>
<tr><td>Lesson</td><td> : <input type=text name='lesson'>
<tr><td colspan=2><input type=submit value=Fill></td></tr>



include "konek.php";
include "config.php";

mysql_query("INSERT INTO data(nama,kelas,induk,mapel,jam_hadir) VALUES('$_POST[nme]','$_POST[class]','$_POST[num]',$_POST[lesson]','$jam')");

/*Declaration,if time now more or less from time get in*/

if($hour <= $time){
echo "You've been absented,let's go to class !"; }
else {
echo "You're late,let's go to picket room to received your late letter"; }
<a href=absen.php>Absent again</a>";

Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s