<title>Simple Online Attendance System - Avadh Tutor</title><style type="text/css">
<!--
.style1 {
font-family: "Courier New", Courier, monospace;
font-size: 60px;
color: #FFFFFF;
font-style: italic;
}
.style2 {
font-size: 24px;
color: #0000FF;
}
.style7 {color: #FFCCFF}
-->
</style>
<script type="text/javascript">
function getatt(value)
{
if(value == true)
{
document.getElementById("txtAbsent").value = parseInt(document.getElementById("txtAbsent").value) - 1;
document.getElementById("txtPresent").value = parseInt(document.getElementById("txtPresent").value) + 1;
}
else
{
document.getElementById("txtAbsent").value = parseInt(document.getElementById("txtAbsent").value) + 1;
document.getElementById("txtPresent").value = parseInt(document.getElementById("txtPresent").value) - 1;
}
}
</script>
<table width="800" border="1" align="center">
<tr>
<td bordercolor="#330033" bgcolor="#CCCCFF"><h1 align="center"><strong><span class="style1">Attendance System</span></strong></h1></td>
</tr>
<tr>
<td bgcolor="#999966"><div align="center">
<?php
include "menu.php";
?>
</div> </td>
</tr>
<tr>
<td>
<form action="getattendance1.php" method="post">
<table width="180px" align="left" style="">
<tr>
<td> Select date : <br />
<?php
$dt = getdate();
$day = $dt["mday"];
$month = date("m");
$year = $dt["year"];
echo "<select name='cdate'>";
for($a=1;$a<=31;$a++)
{
if($day == $a)
echo "<option value='$a' selected='selected'>$a</option>";
else
echo "<option value='$a' >$a</option>";
}
echo "</select><select name='cmonth'>";
for($a=1;$a<=12;$a++)
{
if($month == $a)
echo "<option value='$a' selected='selected'>$a</option>";
else
echo "<option value='$a' >$a</option>";
}
echo "</select><select name='cyear'>";
for($a=2010;$a<=$year;$a++)
{
if($year == $a)
echo "<option value='$a' selected='selected'>$a</option>";
else
echo "<option value='$a' >$a</option>";
}
echo "</select>";
?>
</td>
</tr>
</table>
<table width="400" border="2" align="left" bordercolor="#9966FF" bgcolor="#C7B6B1" style="margin-left:20px;">
<tr>
<td colspan="3" bgcolor="#9999CC"><div align="center"><strong><span class="style2">Get Attendance</span></strong></div></td>
</tr>
<tr bgcolor="#999966">
<td width="114"><span class="style7">Enrolment no</span></td>
<td width="152"><span class="style7">Name</span></td>
<td width="110"><span class="style7">Attend</span></td>
</tr>
<?php
include "z_db.php";
extract($_POST);
$query = "select *from `member` order by `member_id`";
$s = 0;
$result = mysqli_query($con,$query)or die("select error");
while($rec = mysqli_fetch_array($result))
{
$s = $s + 1;
echo ' <tr>
<td width="114">'.$rec["enrolment_no"].'</td>
<td width="152">'.$rec["name"].'</td>
<td width="110"><input type=checkbox name='.$rec["member_id"].' onclick="getatt(this.checked);"/></td>
</tr>';
}
?>
<tr>
<td colspan="3"><div align="center">
<input type="submit" value="Get Attendance" name="btnsubmit"/>
</div></td>
</tr>
</table>
</form>
<table width="100px" align="right" style="margin-left:35px">
<tr>
<td> Total Absent : <input type="text" id="txtAbsent" value="<?php print $s; ?>" size="10" disabled="disabled"/></td>
</tr>
<tr>
<td> Total Present : <input type="text" id="txtPresent" value="0" size="10" disabled="disabled"/></td>
</tr>
<tr>
<td> Total Strength : <input type="text" id="txtStrength" value="<?php print $s; ?>" size="10" disabled="disabled"/></td>
</tr>
</table>
</td>
</tr>
</table>
<?php include "footer.php"; ?>
________________________________________________
getattendance1.php
<?php
if(isset($_POST["btnsubmit"]))
{
include "z_db.php";
$date = $_POST["cyear"]."-".$_POST["cmonth"]."-".$_POST["cdate"];
$query = "select *from `member` ";
$result = mysqli_query($con,$query)or die("select error");
while($rec = mysqli_fetch_array($result))
{
$mno = $rec["member_id"];
if(isset($_POST[$mno]))
{
$query1 = "INSERT INTO `attandance`(`member_id` , `date` , `attendance`) VALUES('$mno','$date','1')";
}
else
{
$query1 = "INSERT INTO `attandance`(`member_id` , `date` , `attendance`) VALUES('$mno','$date','0')";
}
mysqli_query($con,$query1)or die("insert error".$mno);
print "<script>";
print "alert('Attendance get successfully....');";
print "self.location='getattendance.php';";
print "</script>";
}
}
else
{
header("Location:index.php");
}
?>
<?php include "footer.php"; ?>
_____________________________________________________
printreport.php
<title>Online Attendance - Avadh Tutor</title>
<style type="text/css">
<!--
.style1 {
font-family: "Courier New", Courier, monospace;
font-size: 60px;
color: #FFFFFF;
font-style: italic;
}
.style2 {
font-size: 24px;
color: #0000FF;
}
.style6 {font-size: 16px}
-->
</style>
<table width="800" border="1" align="center">
<tr>
<td bordercolor="#330033" bgcolor="#CCCCFF"><h1 align="center"><strong><span class="style1">Attendance System</span></strong></h1></td>
</tr>
<tr>
<td bgcolor="#999966"><div align="center">
<?php
include "menu.php";
?>
</div> </td>
</tr>
<tr>
<td><div align="center">
<form action="" method="post">
<table width="606" border="2" align="center" bordercolor="#9966FF" bgcolor="#C7B6B1">
<tr><td colspan="3" align="center"><h3>Search Enrolment No Wise Records Here</h3></td></tr>
<tr>
<td width="308" bgcolor="#9999CC"><div align="center"><strong><span class="style2">Enter the enrolment no</span></strong></div></td>
<td width="144" bgcolor="#9999CC"><span class="style6">
<input type="text" name="eno" />
</span></td>
<td width="130" bgcolor="#9999CC"><input type="submit" value="View Information" name="btnsubmit"/></td>
</tr>
</table>
</form>
</div></td>
</tr>
<?php
if(isset($_POST["btnsubmit"]))
{
include "z_db.php";
extract($_POST);
$query = "select * from `member` where enrolment_no = ".$eno." limit 1";
$result = mysqli_query($con,$query)or die("select error error");
while($rec = mysqli_fetch_array($result))
{
echo '<tr><td colspan="2"><table width="400" border="2" align="center" bordercolor="#9966FF" bgcolor="#C7B6B1">
<tr>
<td width="160" bgcolor="#9999CC"><span class="style2">Enrolment No</span></td>
<td width="160" bgcolor="#9999CC"><span class="style2">Name</span></td>';
$query1 = "select * from `attandance` where `member_id` = ".$rec["member_id"]." order by date";
$result1 = mysqli_query($con,$query1)or die("select error error");
while($rec1 = mysqli_fetch_array($result1))
{
echo '<td bgcolor="#9999CC" class=style2>'.$rec1["date"].'</td>';
}
echo '</tr>
<tr>
<td width="222"><span class="style6">'.$rec["enrolment_no"].'</span></td>
<td width="222"><span class="style6">'.$rec["name"].'</span></td>';
$query1 = "select *from `attandance` where `member_id` = ".$rec["member_id"]." order by date";
$result1 = mysqli_query($con,$query1)or die("select error error");
while($rec1 = mysqli_fetch_array($result1))
{
echo '<td>';
if($rec1["attendance"]==0)
echo "Absent";
else
echo "Present";
echo '</td>';
}
echo '
</tr>
</table></td></tr>';
}
}
else
{
include "z_db.php";
extract($_POST);
$query = "select * from `member` ";
$result = mysqli_query($con,$query)or die("select error error");
while($rec = mysqli_fetch_array($result))
{
echo '<tr><td colspan="2"><table width="90%" border="2" align="center" bordercolor="#9966FF" bgcolor="#C7B6B1">
<tr>
<td width="160" bgcolor="#9999CC"><span class="style2">Enrolment No</span></td>
<td width="160" bgcolor="#9999CC"><span class="style2">Name</span></td>';
$query1 = "select * from `attandance` where `member_id` = ".$rec["member_id"]." order by date";
$result1 = mysqli_query($con,$query1)or die("select error error");
while($rec1 = mysqli_fetch_array($result1))
{
echo '<td bgcolor="#9999CC" class=style2>'.$rec1["date"].'</td>';
}
echo '</tr>
<tr>
<td width="222"><span class="style6">'.$rec["enrolment_no"].'</span></td>
<td width="222"><span class="style6">'.$rec["name"].'</span></td>';
$query1 = "select *from `attandance` where `member_id` = ".$rec["member_id"]." order by date";
$result1 = mysqli_query($con,$query1)or die("select error error");
while($rec1 = mysqli_fetch_array($result1))
{
echo '<td>';
if($rec1["attendance"]==0)
echo "Absent";
else
echo "Present";
echo '</td>';
}
echo '
</tr>
</table></td></tr>';
}
}
?>
</table>
<?php include "footer.php"; ?>
_________________________________________________
viewmember.php
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Online Attendance System - Avadh Tutor</title><style type="text/css">
<!--
.style1 {
font-family: "Courier New", Courier, monospace;
font-size: 60px;
color: #FFFFFF;
font-style: italic;
}
.style2 {
font-size: 24px;
color: #0000FF;
}
.style6 {font-size: 16px}
-->
tr{
}
tr:hover{
background-color: yellow;
}
</style></head>
<body>
<table width="800" border="1" align="center">
<tr>
<td bordercolor="#330033" bgcolor="#CCCCFF"><h1 align="center"><strong><span class="style1">Attendance System</span></strong></h1></td>
</tr>
<tr>
<td bgcolor="#999966"><div align="center">
<?php
include "menu.php";
?>
</div> </td>
</tr>
<tr style="background-color: white;"><td colspan="2">
<form action="" method=post>
<table width="500" border="2" align="center" cellpadding="5" cellspacing="10" bordercolor="#9966FF" bgcolor="#C7B6B1">
<tr>
<td colspan="5" bgcolor="#9999CC"><div align="center"><strong><span class="style2">Member information</span></strong></div></td>
</tr>
<tr>
<td bgcolor="#9999CC"><div align="center"><strong><span class="style2">Enrolment No</span></strong></div></td>
<td bgcolor="#9999CC"><div align="center"><strong><span class="style2">Name</span></strong></div></td>
<td bgcolor="#9999CC"><div align="center"><strong><span class="style2">Mobile</span></strong></div></td>
<td bgcolor="#9999CC"><div align="center"><strong><span class="style2">Email</span></strong></div></td>
<td bgcolor="#9999CC"><div align="center"><strong><span class="style2">Delete</span></strong></div></td>
</tr>
<?php
include "z_db.php";
$query = "select *from `member` ";
$result = mysqli_query($con,$query)or die("select error error");
while($rec = mysqli_fetch_array($result))
{
echo '<tr height=30px>
<td width="222"><span class="style6">'.$rec["enrolment_no"].'</span></td>
<td width="222"><span class="style6">'.$rec["name"].'</span></td>
<td width="222"><span class="style6">'.$rec["mobile"].'</span></td>
<td width="222"><span class="style6">'.$rec["email"].'</span></td>
<td width="222"><span class="style6">';
echo '<a style="background-color:#CCCCCC;color:#CC3333;border:solid;text-decoration:none;border-radius:10px;position:relative;top:0px;border-color:red;" href="deletemember.php?d='.$rec["member_id"].'"> Delete </a></span></td></tr>';
}
?>
</table>
</form>
</td>
</tr>
</table>
<?php include "footer.php"; ?>
________________________________________________________
deletemember.php
<?php
include_once "z_db.php";
mysqli_query($con,"DELETE FROM `member` WHERE `member_id` = ".$_GET["d"]." LIMIT 1;") or die("Delete member error");
print "<script>";
print "alert('Member Deleted succesfully.....');";
print " self.location='viewmember.php';"; // Comment this line if you don't want to redirect
print "</script>";
?>
<?php
include "footer.php";
?>
_______________________________________________________
Thanks for watch Our Blog
Learn All Programming and Scripting Languages with youtube.com/avadhtutor