Thursday 3 September 2015

Multiple Checkbox with php and my sql


This is the code for creating multiple checkbox using phpand mysql

<?php
include "connect.php";
session_start();




$show11=mysql_query("select * from class_login where email_id='$class_email11' and is_del='approved'") or die(mysql_error());
while($row11=mysql_fetch_array($show11))

{

$class_id=$row11['class_id'];
$class_email=$row11['email_id'];
$class_name=$row11['class_name'];
}


?>

<?php

 $chk11=$_POST["chk1"];

  $query;

 for($i=0;$i<sizeof($chk11);$i++)
 {


$show11=mysql_query("select * from students where stud_id='".$chk11[$i]."'  and is_del='approved'") or die(mysql_error());
 while($row=mysql_fetch_array($show11))

{
$row ['stud_name'];



$query=mysql_query("Insert Into attendance_add(id,stud_id,stud_name,date,time,branch_id,batch_id,status,is_del)values('','$chk11[$i]','".$row ['stud_name']."','".date("d-m-y")."','".time("hh:mm:ss")."','".$row ['branch_id']."','".$row ['batch_id']."','present','approved')") or die(mysql_error());
}


 }

 /* For Absent students... */

 $show112=mysql_query("select * from students where branch_id='".$_SESSION['branch_id']."' and batch_id='".$_SESSION['batch_id']."' and is_del='approved'") or die(mysql_error());
 while($row12=mysql_fetch_array($show112))

{
$row12 ['stud_name'];
$stud_id1=$row12['stud_id'];

$show1133=mysql_query("select * from attendance_add where stud_id='$stud_id1' and date='".date("d-m-y")."' and branch_id='".$_SESSION['branch_id']."' and batch_id='".$_SESSION['batch_id']."' and is_del='approved'") or die(mysql_error());
 $number_of_rows = mysql_num_rows($show1133);
 if($number_of_rows==0)
 {
$query12=mysql_query("Insert Into attendance_add(id,stud_id,stud_name,date,time,branch_id,batch_id,status,is_del)values('','$stud_id1','".$row12 ['stud_name']."','".date("d-m-y")."','".time("hh:mm:ss")."','".$row12 ['branch_id']."','".$row12['batch_id']."','absent','approved')") or die(mysql_error());

 }


}
echo '<script type="text/javascript">';
echo 'alert("Todays attendance Inserted Succesfuuly..");';
echo 'window.location.href = "branches.php";';







?>





?>



/*this is the code for inserting into database*/




<?php
session_start();
include"connect.php";



$todats_date=date("Y/m/d");
?>


<head>
<meta http-equiv="Content-Type" content="" />
<meta name="viewport" content="">
<meta name="author" content="" />
<meta name="description" content="" />
<meta name="keywords" content="" />
<title>Attendance Management</title>
<link rel="stylesheet" type="text/css" href="style.css" media="screen" />
<!-- Hide Mobiles Browser Navigation Bar -->
<script type="text/javascript">
window.addEventListener("load",function() {
// Set a timeout...
setTimeout(function(){
// Hide the address bar!
window.scrollTo(0, 1);
}, 0);
});
</script>

<script type="text/javascript">
checked=false;
function checkedAll (frm1) {var aa= document.getElementById('frm1'); if (checked == false)
{
checked = true
}
else
{
checked = false
}for (var i =0; i < aa.elements.length; i++){ aa.elements[i].checked = checked;}
}
</script>

 <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
       
       <script type="text/javascript">
               $(document).ready(function(){
                    $("#button").click(function(){

                          var branch_id=$("#branch_id").val();
  var chkbox=$("#chk1").val();
                             var branch_name=$("#branch_name").val();
                     

                          $.ajax({
                              type:"post",
                              url:"insert_attendance.php",
                              data:"chk1="+chkbox+"&branch_name="+branch_name,
                              success:function(data){
                                 $("#info").html(data);
                              }

                          });

                    });
               });
       </script>
<style>
#chkbox
{
margin-left: 120px;
    margin-top: -15px;

}
</style>
</head>

<body>
<div id="main_container">
<div class="header">
    <!--a href="index.php" class="left_bt">home</a-->
    <span>Attendance Management System</span></a>

    </div>
   
  <div class="content">

  <form id ="frm1" action="insert_attendance.php" method="post">
 
   
 <?php

$show11=mysql_query("select * from students where class_email='".$_SESSION['class_email_id']."' and  branch_id='".$_GET['branch_id']."' and batch_id='".$_GET['batch_id']."'  and is_del='approved'") or die(mysql_error());
echo "Check/Uncheck All"; echo "&nbsp;";

echo "<input type='checkbox' name='checkall' onclick='checkedAll(frm1);'>";

echo "&nbsp;&nbsp;&nbsp;&nbsp;";
echo "Date: " . date("Y/m/d") ; echo "&nbsp;&nbsp;";
echo   date("l");
echo "<br>";
while($row11=mysql_fetch_array($show11))

{


//$row11['class_id'];
//$row11['class_email'];
echo "<br>";
echo "<div class=corner_wrap>";
echo "<div id=branch_name>";echo "<br>";

//echo "<a href=students.php?batch_id=".$row11['batch_id']."&amp;branch_id=".$branch11."><strong>".$prathmesh_batch."</strong></a>";
echo "<div id=chkbox>";
echo "<input type=checkbox name=chk1[] id=chk1 value=".$row11['stud_id'].">";echo $row11['stud_name'];

echo "</div>";
echo "</div>";
echo "<div class=clear></div>";
echo " </div>";
echo "<br>";


}


?>
<br />
<input type="submit" id="Submit"  value="Submit" />
<div id="info"/>
</form>
   
</div>

</div>
</body>

<?php include "footer.php";?>

</html>

Wednesday 2 September 2015

Viewer.js using for documentation reading

Viewer.js is the plugin for documentation reading .it is like a pdf reader.it is very to use .it can be integrated very easily with the web application.

There is only one line which is use with web application to read pdf document very easily.

Syntax:
<a href="abc/ViewerJS/#../path/to/filename.pdf">