Posts

Logout Using PHP

<?php // Inialize session session_start(); // Delete certain session unset($_SESSION['email']); unset($_SESSION['id']); // Delete all session variables session_destroy(); // Jump to login page echo '<script type="text/javascript">';  echo 'window.location.href = "index.php";'; echo '</script>';  ?>

Login Using PHP

<?php session_start(); include("config.php"); // or connection here ?> <?php if(isset($_POST['btn_login'])) {  $query="select * from admin_login where email='".$_POST['email']."' and password='".$_POST['password']."' ";  $res=mysqli_query($con,$query) or die(mysql_error($con)); if(mysqli_num_rows($res)>0)       {              $row=mysqli_fetch_array($res);             extract($row);                              //session_start();            $_SESSION['id']=$row['id'];           $_SESSION['email']=$row['email'];                                       echo "<script>";                   echo "alert('Login Successfully');";                    echo "window.location.href='home.php';";                    echo "</script>";                       }      else      {           echo "<script>&qu

Form validation Using Javascript

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Registration Form</title> <!-- Latest compiled and minified CSS --> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous"> <!-- Optional theme --> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous"> <!-- Latest compiled and minified Ja

Button Code For View,Edit,Delete Using PHP MySqli

<td class="center" width="155px">     <a class="btn btn-success" href="showstuinfo.php?id=<?=$id ?>&att_user_department=<?=$branch ?>&year=<?=$year ?>">       <i class="fa fa-eye" title="View"></i>       </a>     <a class="btn btn-info" href="editstuinfo.php?id=<?=$id ?>&att_user_department=<?=$branch ?>&year=<?=$year ?>">       <i class="fa fa-pencil" title="Edit"></i>       </a>     <a onclick='javascript:confirmationDelete($(this));return false;' class="btn btn-danger" href="deletestudent.php?id=<?=$id ?>&att_user_department=<?=$branch ?>&year=<?=$year ?>">       <i class="fa fa-trash-o" title="Delete"></i>     </a> </td>

Table With Search And Pagination

<!DOCTYPE html>    <html lang="en">    <head>    <meta charset="utf-8">    <title>Example of Employee Table with twitter bootstrap</title>    <meta name="description" content="Creating a Employee table with Twitter Bootstrap. Learn with example of a Employee Table with Twitter Bootstrap.">   <link href="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css" rel="stylesheet">    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script> <link rel="stylesheet" href="http://cdn.datatables.net/1.10.2/css/jquery.dataTables.min.css"></style> <script type="text/javascript" src="http://cdn.datatables.net/1.10.2/js/jquery.dataTables.min.js"></script> <script type="text/javascript" src="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstr

Gender Update (Radio Button) Using PHP Mysqli

<div class="form-group">                   <label for="exampleInputEmail1">Gender</label><br/>                                       <input type="radio" name="att_user_gender" value="Male"<?php if($row['att_user_gender']=="Male"){ echo "checked";}?> />Male &nbsp;&nbsp;                     <input type="radio" name="att_user_gender"  value="Female" <?php if($row['att_user_gender']=="Female"){ echo "checked";}?>/>Female                 </div>

Addition Using Javascript (OnClick)

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Javascript Addition</title> <style> body {     background-color:#093;     padding:0px;     margin:0px;     font-family:Verdana, Geneva, sans-serif;     font-size:12px; } .frm1 {     border:2px solid #006; } </style> </head> <body> <script> function sum() {         var txtFN = parseInt(document.getElementById('txt1').value);         var txtSN = parseInt(document.getElementById('txt2').value);         var result = parseInt(txtFN) + parseInt(txtSN);         document.getElementById('txt3').value = result; } function clr() {     document.getElementById('txt1').value = "";     document.