Friday 8 April 2016

Quiz /Online Exam in PHP with use of checkbox ,and inserting record in mysql database using PHP

Code for Form in PHP

echo "<form name=myfm method=post action=insert_answers.php>";
echo"<fieldset>";
$n=$question_count;
echo "<table width=100%>";
echo "<tr><td><input type=hidden name=member[question][] value='".$row_prathmesh['que_id']."'> Que ".  $n .":'".$row_prathmesh['que_desc']."';";echo"</td><tr>";
//member[ans1][]
echo "<tr><td><input type=checkbox name=member[group][] value=1>$row_prathmesh[3]";echo"</td><tr>";
echo "<tr><td><input type=checkbox name=member[group][]  value=2>$row_prathmesh[4]";echo"</td><tr>";
echo "<tr><td><input type=checkbox name=member[group][]  value=3>$row_prathmesh[5]";echo"</td><tr>";
echo "<tr><td><input type=checkbox name=member[group][]  value=4>$row_prathmesh[6]";echo"</td><tr>";



$question_count++;
echo "</table>";
echo"</fieldset>";
echo"<br>";
}
echo"<input type=submit name=submit value=Submit></form>";

-------------------------------------------------------------------------------------------------------------------------

Inserting Record In database while using multiple checkboxes


    for($i=0 ;$i &lt;= count($_POST['member']); $i++)
{
$member=$_POST['member'];
//$ans=$_POST['ans'];
echo $ques_id_111=$_POST['member']['question'][$i];


echo $row_abc="select * from mst_question where que_id='".$_POST['member']['question'][$i]."'";
$row_abc=mysql_query($row_abc) or die(mysql_error());
while($row_abc=mysql_fetch_array($row_abc))
{


echo $que_id= $row_abc['que_id'];
echo $row_abc['test_id'];
echo $row_abc['question_no'];
echo $row_abc['que_desc'];
echo $row_abc['ans1'];
 echo"
";

echo $row_abc['ans2'];
 echo"
";

echo $row_abc['ans3'];
 echo"
";

echo $row_abc['ans4'];
 echo"
";

echo $row_abc['true_ans'];

echo "answer of user=".$_POST['member']['group'][$i];echo"
";


$chk="";
$checkbox11=$_POST['member']['group'][$i];

echo insert1="insert into mst_useranswer(sess_id,test_id,que_id,que_des, ans1,ans2,ans3,ans4,true_ans,your_ans) values ('$session_id','".$row_abc['test_id']."','".$row_abc['que_id']."','".$row_abc['que_desc']."','".$row_abc['ans1']."','".$row_abc['ans2']."', '".$row_abc['ans3']."','".$row['ans4']."','".$row_abc['true_ans']."','".$_POST['member']['group'][$i]."')";

mysql_query($insert1) or die(mysql_error());
 echo"
";


}

}
--------------------------------------------------------------------------------------------------------------------------------------------------
Screenshot

Monday 28 March 2016

Code to verify email of user in php

Code to send activate link

$confirm11=rand();
$con=md5($confirm);
$message11=' Your Registration Approved. Your Email and Password for Highclonoid Softec:
Name : '.Highclonoid Softec.'
Email : '.Highclonoid Softec.'
Password : '.Highclonoid Softec.'
category : '.Highclonoid Softec.'
your referal code to invite friend: '.Highclonoid Softec.'
Thanks for Registration
To Activate your profile click on below link or copy link to url bar(address bar)

http://HighclonoidSoftec.com/web/activation.php?con='.$con.'
';
$to= $email;
$from="info@Highclonoid Softec.com";
$subject1 = "Highclonoid Softecapproval request";
$mail_body = '
Message: '.$message11.'
From: ' . $from . '
Subject: ' . $subject1 . '

';

$headers  = "Highclonoid Softec.com";
$headers .= "Content-type: text/htmlrn";
mail($to, $subject1, $mail_body, $headers);



---------------------------------------------------------------------------------
Code to activate the link
<?php


$id=$_GET['con'];


$query=mysql_query("UPDATE  registration SET approval='approved' WHERE confirm_code='$id'") or die(mysql_error());

$sql="SELECT * FROM registration WHERE confirm_code='$id' and approval='approved'";
$result=mysql_query($sql) or die(mysql_error());

// Mysql_num_row is counting table row
while($row=mysql_fetch_array($result))
{


$fullName=$row['fullName'];
$email=$row['email'];
$contact=$row['contact'];
$category=$row['category'];
$sub_type=$row['sub_type'];
$city=$row['city'];






$message11='profile is activated at Highclonoid Softec.com
Name : '.$fullName.'
Email : '.$email.'
Contac No. : '.$contact.'
Category. : '.$category.'
subcategory. : '.$sub_type.'
city. : '.$city.'
';
$to= "Highclonoid Softec.com@gmail.com";
$from="info@Highclonoid Softec.com";
$subject1 = "'profile is activated at Highclonoid Softec.com";
$mail_body = '
Message: '.$message11.'
From: ' . $from . '
Subject: ' . $subject1 . '

';

$headers  = "Highclonoid Softec.com";
$headers .= "Content-type: text/htmlrn";
mail($to, $subject1, $mail_body, $headers);

$message11='profile is activated at Highclonoid Softec.com
Name : '.$fullName.'
Email : '.$email.'
Contac No. : '.$contact.'
Category. : '.$category.'
subcategory. : '.$sub_type.'
city. : '.$city.'
';
$to=$email;
$from="info@Highclonoid Softec.com";
$subject1 = "'profile is activated at Highclonoid Softec.com";
$mail_body = '
Message: '.$message11.'
From: ' . $from . '
Subject: ' . $subject1 . '

';

$headers  = "Highclonoid Softec.com";
$headers .= "Content-type: text/htmlrn";
mail($to, $subject1, $mail_body, $headers);



echo '<script type="text/javascript">';
echo 'alert("Your Email has been verified and Profile is activated and please Login");';
echo 'window.location.href = "login.php";';
echo '</script>';

}
?>

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">

Wednesday 26 August 2015

shikshansuvidha.com

shikshansuvidha.com








Shikshansuvidha.com is the website for profile listing of teacher , class and institute to serve educational info to students & parents.Teacher,class and institute get facilities like demo lecture video,photos,brochure,qualification,expe­rience,subjects,etc. Sign Up today for free by visiting to our website www.shikshansuvidha.com !!!

shikshansuvidha.com





Writing functions in php

Writing functions in php  for inserting data  in mysql using php

$car_class="bmw";
$description="nice car";

$car_class and $description are the variable which are being passed to function for inserting data in database.


insert_class_car($car_class,$description);


insert_class_car($car_class,$description);

above syntax is calling function,

function insert_class_car($car_class,$description)
{
$car_class_1=$car_class;
$description_1=$description;

$query=mysql_query("Insert Into car_class(id,class_name,description,is_del)values('','$car_class_1','$description_1','approved')") or die(mysql_error());
}

above syntax is body of fucnction.