Friday 25 December 2020

Tuesday 8 December 2020

Online Attendance System Using PHP

 Online Attendance System Using PHP

DATABASE: online_attendance

Table: Attendance



Table: member



____________________________________________

Create Below PHP Files

Connection File: z_db.php

<?php
$con=mysqli_connect("localhost","root","","online_attendance");
?>

___________________________________________

menu.php


<style type="text/css">
.menu{
color: white;
background-color: black;
padding: 10px;
font-size: 1.3em;
text-decoration: none;
}
.menu:hover{
color: tomato;
background-color: yellow;
padding: 10px;
box-shadow: 5px 4px 5px 1px;
}
</style>
<ul style="list-style:none;display:inline-block">
<li style="float:left">&nbsp;&nbsp;&nbsp;&nbsp;<a href="index.php" class="menu">Add Member</a>&nbsp;&nbsp;&nbsp;&nbsp;</li>
    <li style="float:left">&nbsp;&nbsp;&nbsp;&nbsp;<a href="getattendance.php" class="menu">Get Attendance</a>&nbsp;&nbsp;&nbsp;&nbsp;</li>
    <li style="float:left">&nbsp;&nbsp;&nbsp;&nbsp;<a href="printreport.php" class="menu">Print Report</a>&nbsp;&nbsp;&nbsp;&nbsp;</li>
    <li style="float:left">&nbsp;&nbsp;&nbsp;&nbsp;<a href="viewmember.php" class="menu">View Member</a>&nbsp;&nbsp;&nbsp;&nbsp;</li>
</ul>

__________________________________________

footer.php



<div style="background-color: black; color: white; font-size: 1.4em; padding: 12px; text-align: center;">Design & Developed By: Avadh Tutor</div>
<div style="background-color: tomato; color: white; font-size: 1.6em; padding: 10px; text-align: center;">

<marquee>
Learn All Programming languages with youtube.com/avadhtutor
</marquee>

</div>
<div style="background-color: black; color: white; font-size: 1.4em; padding: 10px; text-align: center;">All Examples inside pandyaripal.blogspot.com</div>



_________________________________________

index.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></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>
        <td><div align="center">
        <form action="insertmember.php" method="post">
          <table width="400" border="2" align="center" bordercolor="#9966FF" bgcolor="#C7B6B1">
            <tr>
              <td colspan="2" bgcolor="#9999CC"><div align="center"><strong><span class="style2">Enter the member information</span></strong></div></td>
            </tr>
            <tr>
              <td width="160"><span class="style6">Name</span></td>
              <td width="222"><span class="style6"><input type="text" name="name" /></span></td>
            </tr>
            <tr>
              <td><span class="style6">Mobile</span></td>
              <td><span class="style6"><input type="text" name="mobile" /></span></td>
            </tr>
            <tr>
              <td><span class="style6">Email</span></td>
              <td><span class="style6"><input type="email" name="email" /></span></td>
            </tr>
            <tr>
              <td colspan="2"><div align="center">
                <input type="submit" value="Add Member" name="btnsubmit"/>
                &nbsp;&nbsp;
                <input type="reset" value="Reset" name="btnreset"/>
              </div></td>
            </tr>
          </table>
          </form>
        </div></td>
      </tr>
    </table>
<?php include "footer.php"; ?>
</body>
</html>


__________________________________________________

insertmember.php



<?php
if(isset($_POST["btnsubmit"]))
{
extract($_POST);
include "z_db.php";
if($rec=mysqli_fetch_array(mysqli_query($con,"SELECT member_id FROM `member` order by member_id desc limit 1")))
{
$bid =1+ $rec['member_id'];
}
$en = date("Y").$bid;
$query = "INSERT INTO  `member`(`enrolment_no` ,  `name` ,  `mobile` ,  `email`) VALUES('$en','$name','$mobile','$email')";

$q = mysqli_query($con,$query)or die("insert error");
print "<script>";
print "alert('Member add successfully....');";
print "self.location='index.php';";
print "</script>";
}
else
{
header("Location:index.php");
}
?>
<?php include  "footer.php"; ?>



____________________________________________________

getattendance.php




<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"/>
                &nbsp;&nbsp;</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"].'">&nbsp;Delete&nbsp;</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

_____________________________________________________






Monday 7 December 2020

Simple Difference Between HTML vs CSS Program

 HTML V/s CSS Simple Program


Save this file as a 1.html

_____________________________________

<!-- HTML -->

<p bgcolor=red> welcome 123</p> <!-- Not Supported By HTML -->

<!-- CSS -->

<p style="background-color:red; ">welcome</p> <!-- Using CSS Background Attribute -->


<br>

<marquee bgcolor=red>welcome</marquee>

<br><br>

<!-- CSS -->

<a href="" style="text-decoration:none;">Home</a> <!-- remove Underline from link -->


<br><br>

<!-- HTML -->

<a href=""><font color=orange><b>Contact Us</b></font></a> 


<br><br>

<!-- CSS -->

<a href="" style="color:orange; text-decoration:none; ">Contact Us</font>


Copy and Past This Code inside a 1.html file and run it to your browser

Learn All programming and Scripting languages with youtube.com/avadhtutor/







no exports found that matches the constraint