Tuesday, 19 January 2021

JavaScript Events

 JavaScript Events

onclick(): click on object (elements) then event are occurred

<input type=button value="click me" onclick="alert(' Welcome to Onclick event')">

________________________


ondblclick(): ondblclick event occurred when two time click on object for example:

<script>

function sum()

{

a= 20;

b=30;

c = a+b;

document.write(c);

}

</script>

<input type=button value="addition" ondblclick="sum(); ">

___________________________

onmousemove() or mouseover: 

- this event is working with your cursor is going inside a Object then Mousemoved are Fire

- if your cursor are go inside an elements then move event occured

<script>

    function news()

    {

    alert("todays we are worked with JavaScript events \n All                 Subjects are Important for Future");

    }

</script>

<br><br>

<p style="background-color:yellow;" onmousemove="alert('this is a Mouse Move Event');">welcome</p>


<br><br>


<input type=button onmousemove="news();" value="NEWS">


Mouseover():


<script>

function abc()

{

alert("Welcome to Mouse Move event");

}

function xyz()

{

alert("Welcome to Mouse Over Event");

}\

</script>

<input type=button onmousemove="abc();" value="    Mouse Move    ">

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

<input type=button onmouseover="xyz();" value="    Mouse Over    ">

_____________________


MouseOut(): mouse out is working with if you are loss or leave the cursor on object 

<script>

function test()

{

alert("This is a Mouse Out event");

}

</script>

<input type=button onmouseout="test();" value="    Mouse Out    ">


___________________________

onfocus(): this event occurred when you tab or click on object

- The onfocus event is most often used with <input>, <select>, and <a>.


<script>

function y()

{

alert("Please Not Write Content Here");

document.frm.t1.value="Avadh Tutor";

} 

function z()

{

document.frm.t2.value="";

}

</script> 

<form name="frm">

<input type="text" name="t1"  value="" onfocus="y();" ><br>

<input type="text" name="t2" value="" onfocus="z();">

</form>


Example 2: Onfocus with Color Change

<script>

function setStyle(x)

{

var a = document.getElementById(x);

document.getElementById(x).style.background="black";

document.getElementById(x).style.color="white";

document.getElementById(x).style.fontSize="10";


}

</script>

First name: <input type="text" onfocus="setStyle(this.id)" id="zxcvxx">

<br />

Last name: <input type="text" onfocus="setStyle(this.id)" id="cvx">

__________________________________


onkeyup(): when your key is up inside a keyboard

- when the user releases a key

<script>


function y()

{

alert("Please Not Write Content Here");

document.frm.t1.value="Bhavin";

} 

function z()

{

document.frm.t2.value="";

}

</script> 

<form name="frm">

<input type="text" name="t1"  value="" onkeyup="y();" ><br>

<input type="text" name="t2" value="" onkeyup="z();">

</form>

__________________________

onChange(): when the value of an element has been changed, For radiobuttons and checkboxes, the onchange event occurs when the checked state has been changed, onchange event occured when you change your data (value)

Example : 

<script>

function abc()

{

alert(document.frm.product.value);

}

</script>

</head>

<body>

<form name="frm" method=post>

<select name="product" onchange="abc();" >

<option value="this">INDIA</option>

<option value="is">B</option>

<option value="best">C</option>

<option value="you">D</option>

</select>

</form> 

___________________________________________________

onSubmit(): onSubmit event is Work with form with Submit Button, When you click on Submit then onsubmit event will be fired

Example:

<script>

function abc()

{

alert(document.frm.nm.value);

alert(document.frm.pass.value);


}

</script>


<form name=frm  onsubmit="abc()" method=post>

name<input type=text name=nm value="">

password<input type=password name=pass value="">

<input type=submit value="click now"  >

</form>

_____________________________________________________

onBlur() : most often used with form validation code

<input type="text" id="myInput" onfocus="focusFunction()" onblur="blurFunction()" placeholder="Enter Your Name">


<script>

function focusFunction() {

   document.getElementById("myInput").style.background = "tomato";

}


function blurFunction() {

   document.getElementById("myInput").style.background = "blue";

}

</script>

_________________________________________

onReset(): occurs when a form is reset (clear).

Example :

<form onreset="my()">

  Enter name: <input type="text" placeholder="Enter Name">

  <input type="reset">

</form>

<script>

function my() {

  alert("The form was reset");

}

</script>



 



 



JavaScript Array

 What is Array:

- array is a single variable that is used to store different elements.

- by default index of array is 0

- Array is stored multiple values inside a Single Variable Using New Keyword

____________________________________


Difference Between Array and Variable

- Array is Stored Multiple Values inside a Single variable using New Keyword

- Variable is Stored only Single value At a time 

 Example of Variable and Array:

<script>

//variable is store run time only one value at a time

a = 1,2,3,4;

document.write(a);

document.write("<hr>");


        //array

a = new Array(10,20,30,40,100);

document.write(a);

</script>

Output of variable:

1

Output of Array:

1,2,3,4

_______________________________________________

Index wise Array Printing:

<script>

//index wise array fetch

a = new Array(10,30,40,50,100)

document.write(a);

document.write("<hr>");

document.write(a['1']);

document.write("<hr>");

document.write(a['4']);

</script>

Output:

10,30,40,50,100

_____________

30

_____________

100

______________________________________________________

Array With ForLoop:

<script>

jay = new Array("jayesh","kishan","nayan",30,40);

document.write(jay[0]);

document.write("<hr>");

for(i=0;i<=4;i++)

{

alert(jay[i]);

document.write("Your data is:"+jay[i]+"<br>");

}

</script>



Sunday, 10 January 2021

JavaScript Dialog Boxes

 JAVASCRIPT DIALOGBOX

There are three types of Dialog Boxes are available in java Script

- Alert()

- Confirm()

- Prompt()

___________________________________________________________

alert() : An alert box is used if you want to sure information comes through to the user.

Example 1:

<script>

document.write("Dialog Boxes");

alert("Welcome to My BOX");

</script>


Example 2: Addition

<script>

a = 10;

b= 20;

c = a+b;


document.write(c);

alert("Addition is : "+c);


</script>


Example 3: alert with Button

<input type=button value="Click Me" onclick="alert(' Welcome to JavaScript')"> 

<br><br>


<input type=button value="Register" onclick="alert(' Welcome to MY Alert BOX')"> 

<br><br>


<input type=button value="HI Friends" onclick="alert(' This is Scripting Language')"> 

<br><br>


__________________________________________________

Confirm(): A confirm box is often used if you want the user to verify or accept something. confirm box provide two buttons OK and Cancel

Example:

<script>

alert("Thanks for Visit My WebSite");

confirm("Are Your Sure to Delete ....");

</script>

______________________________________________________

Prompt(): A prompt box is often used if you want the user to input a value before entering a page. prompt box provide input box with OK and cancel button when click on OK then return return if you click on cancel button then return false

Example 1: 

<script>

//getiing a values from the user using Prompt Box

prompt("Enter NO");

</script>


Example 2: 

<script>

i = prompt("Enter Your Name");

document.write("Your Name is :"+i);

</script>


Example 3:

<script>

//prompt getting a by default values are string


//Converting a String to Integer using parseInt() 


a= parseInt(prompt("Enter No")); 

b = parseInt(prompt("Enter No2")); 

c = a+b; 

document.write("Addition is : "+c);

</script>








Conditional Statement Using Java Script

 Java Script Conditional Statement

IF... ELSE Statement:

The if/else statement executes a block of code if a specified condition is true ther wise false.

Example: 
<script>
a= 10;
b =10;
if(a==b)
{
document.write("<h1>Avadh Tutor</h1>");
alert("All Programming languages ");
document.write("Thanks For Watch");
}
else
{
alert("Welcome to Avadh tutor");
}
if(a<b)
{
document.write("<h1>please Subscribe Our Blog</h1>");
alert("youtube.com/avadhtutor");
document.write("pandyaripal.blogspot.com");
}
else
{
alert("all programming are here");
}
if(a>b)
{
document.write("<h1>Greater then</h1>");
alert("True");
document.write("A is Small");
}
else
{
alert("abcd");
}
</script>

_____________________________________________________

IF ..... ELSE IF..... 

Example:

<script type="text/javascript">

var a=parseInt(prompt("Enter No A",""));


var b=parseInt(prompt("Enter No B",""));

if(a<b)

{

document.write("A Is Less Then Of 20 <br>");

}

else if(a==b)

{

document.write("A is equal to B <br>");

}

else if(a<50)

{

alert("hello");

}

else

{

alert("this is a alert box");

}

</script>

__________________________________________________________

Switch Statement using Java Script:

Example:

<script type=text/javascript>

var d=new Date();

abc=d.getDay();

a = parseInt(prompt("enter Switch",""));

switch (a)

{

default:

  alert("no case define");

break;

case 0:

document.write("Hello");

break;

case 1:

document.write("Monday");

break;

case 2:

  document.write("welcome");

  break;

case 3:

  document.write(" Tamene Game e rakho");

  break;

case 4:

  document.write("Sleepy THUS");

  break;

case 5:

  document.write("Sleepy FRI");

  break;

case 6:

alert("end of");

break;

}

</script> 

___________________________________________________________

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



What is While Loop? Example of While Loop in Java Script

 WHILE LOOP

 - A while loop in C programming repeatedly executes a target statement as long as a given condition is true.

 - The condition may be any expression, and true is any nonzero value. The loop iterates while the condition is true.

______________________________________

Syntax of While Loop:

    var initialization;

    while(condtion)

    {

        Statement

        increment/ decrement

    }

_______________________________________

Example of While Loop:

<script type="text/javascript" language="javascript">

//while loop

i=0;

b=0;

while (i<5)

{

  document.write("The number is " + i)

  document.write("<br />");

while(b<=3)

{

alert(b);

b++;

}

        i++;

}

</script>

_______________________________________

learn All Programming and Scripting languages with youtube.com/avadhtutor




    

Java Script operators

JAVA SCRIPT OPERATOR

Following Operator Provide by Java Script: Arithmetic, Assignment, Comparison, Logical

 


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



Friday, 8 January 2021

Java Script ForLoop Example

 



JAVASCRIPT FORLOOP EXAMPLES
Example 1:  Simple ForLoop
<script>
 /*
Syntax:
for(intializ;conditional; increment / decrement)
{  
coding
} 
*/
for(i=1;i<=5;i++)
{
document.write(i);
}
</script>

Output : 12345


Example 2: ForLoop with Space

<script>
        for(i=1;i<=5;i++)
{
document.write(i+" ");
}
</script>
Output: 1 2 3 4 5


Example 3: Multiple Space Using ForLoop

<script>
        for(i=1;i<=5;i++)
{
document.write(i+" &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
}
</script>
Output: 1     2     3    4     5


Example 4: Print Data in Next Line Using ForLoop

<script>
        for(i=1;i<=5;i++)
{
document.write(i+"<br>");
}
</script>

Output:
1
2
3
4
5


Example 5: ForLoop with Color Formatting

<script>

for(i=1; i<=10; i++)
{
document.write("<font color=red>Number Is:<font><font color=blue>"+i+"</font><br>");
}

</script>



Example 6: star * Pyramid Printing Using ForLoop

<script>
for(i=1;i<=5;i++)
{
for(j=1;j<=i;j++)
{
document.write("*  ");
}
document.write("<br>");
}
</script>

Output:
*
* *
* * *
* * * * 
* * * * *

Example 7: Pyramid Printing Using ForLoop

<script>
for(i=1;i<=5;i++)
{
for(j=1;j<=i;j++)
{
document.write(j+" ");
}
document.write("<br>");
}
</script>

Output:
1
1 2
1 2 3 
1 2 3 4
1 2 3 4 5


Example 8: Descending Numbers using For Loop

<!-- 10 9 8 7 6 5 ...1 -->
<script>
for(i=10; i>=1;i--)
{ document.write(i+" "); }

</script>


Example 9 : ODD Number Printing Using JavaScript

<script>
// 1 3 5 7 9 
for(i=1; i<=10;i=i+2)
{ 
document.write(i+" ");
}

</script>


Example 10 : Even Number Printing Using javaScript

<script>
//0 2 4 6 8 ... 
for(i=0; i<=10;i=i+2)
{
         document.write(i+" "); 
     }

</script>








Variable Declaration Using Java Script

 Java Script variables

Variable are containers that can stores user define values

Define variable using var sign

without any sign variable accessible are flexible and usable

______________________________________________________

Example 1:  Simple variable Declaraton

<script>    

    a = "jay";

    document.write(a);

</script>


Example 2: Simple Calculation

<script>

a=20;

b=30;

c = a+b;

document.write(c);

</script>


Example 3: Concatenate a  variables (Merge)

<script>

var a="jay";

var b="raj";

document.write(a+"<br>"); //single variable access

document.write(b+"<hr>"); //single variable access


/* Concating a Variable (Merge) */

document.write(a,b); //merge variable using (,) sign

document.write(a+b); //merge variable using + sign

</script>


Example 4: Simple Calculations with variable with HTML Formatting

<script>


x= 30;

y = 40;

z = x+y;

document.write("<font color=red>SUM IS: </font><font color=green>",z +"</font><br>");


z = x-y;

document.write("<font color=red>SUB IS: </font><font color=green>",z +"</font><br>");


z = x*y;

document.write("<font color=red>MUL IS: </font><font color=green>",z +"</font><br>");


z = x/y;

document.write("<font color=red>DIV IS: </font><font color=green>",z +"</font>");


</script>


___________________________________________

All Programming languages step by step with youtube.com/avadhtutor/playlists/



Simple Example of Java Script

 Simple Example are Listed Here

Example 1: simple printing Statement, java script with html, java script with CSS

<script>

document.write("Hello Welcome");

document.write("<marquee>welcome to JS</marquee>");

document.write(" <p style='color:red; background-color:blue; '>welcome CSS</p>   ");

</script>

OutPut here :





Example 2:  Simple Calculation Using JavaScript
<script>
        document.write(3+2);
document.write("<br>");
document.write(3*2);
document.write("<br>");
document.write(3/2);
</script>

Output here:


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




Introduction of Java Script

 : Introduction of JavaScript:

What is JavaScript:

JavaScript is the Programming Language for the Web.

JavaScript can update and change both HTML and CSS.

JavaScript is the world's most popular programming language.

JavaScript is easy to learn.

JavaScript is a dynamic computer programming language. It is lightweight and most commonly used as a part of web pages, whose implementations allow client-side script to interact with the user and make dynamic pages. It is an interpreted programming language with object-oriented capabilities.

________________________________________________________

ADVANTAGES OF JAVA SCRIPT:

Less server interaction - You can validate user input before sending the page off to the server. This saves server traffic, which means less load on your server.

Immediate feedback to the visitors - They don't have to wait for a page reload to see if they have forgotten to enter something.

Increased interactivity - You can create interfaces that react when the user hovers over them with a mouse or activates them via the keyboard.

Richer interfaces - You can use JavaScript to include such items as drag-and-drop components and sliders to give a Rich Interface to your site visitors.

Easy to Use :  Java Script Provide User Friendly Environment

_________________________________________________________

DISADVANTAGES OF JAVA SCRIPT:

Client-side JavaScript does not allow the reading or writing of files. This has been kept for security reason.

JavaScript cannot be used for networking applications because there is no such support available.

JavaScript doesn't have any multi-threading or multiprocessor capabilities.

___________________________________________________________

Steps to create First Program in Java Script:

Step 1: Open Any Editor Like (Notepad, Notepad ++, Sub Lime ....)

Step 2: Write Below Code inside Your Page

<script>

    document.write("welcome to JavaScript");

</script>

_______________________________________________________________

Save this File as a 1.html


Open Your Browser and RUN it: (Output Below)






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

_____________________________________________________