Posts

C R U D E

 REGISTER.PHP <?php include "conn.php"; if(isset($_POST['save'])) { $name=$_POST['name']; $email=$_POST['email']; $password=$_POST['password']; $contact=$_POST['contact']; $hobbies=$_POST['hobbies']; $finalhobb=implode(',',$hobbies); $gender=$_POST['gender']; $sql="INSERT INTO pg(`name`,`email`,`password`,`contact`,`hobbies`,`gender`) VALUES('$name','$email','$password','$contact','$finalhobb','$gender')"; if (mysqli_query($db,$sql)) { header("location:login.php");  exit; }else{ echo "Error:" . $sql . "" . mysqli_error($db); } mysqli_close($db); } ?> <html> <head> <title>Register Now</title> <body> <h1>REGISTER FORM</h1> <form action="" method="post"> Name:<span style="color:red">*</span><input type="text" id="name...

LOGOUT PAGE

 LOGOUT.PHP <?php session_start(); session_destroy(); header( "Location: login.php" ); ? >

LOGIN PAGE

 LOGIN.PHP <?php   include   'conn.php' ; session_start(); if  (isset($_SESSION[ 'username' ])) {     header( "Location: list.php" ); } if  (isset($_POST[ 'submit' ])) {     $email = $_POST[ 'email' ];     $password = $_POST[ 'password' ];     $sql =  " SELECT   *   FROM  ab  WHERE  email_id = '$email'  AND  `password` = '$password' " ;     $result = mysqli_query($db,$sql);      if  (mysqli_num_rows($result) >  0 ) {         $row = mysqli_fetch_assoc($result);         $_SESSION[ 'username' ] = $row[ 'fullname' ];         header( "Location: list.php" );     }  else...

EDIT PAGE

 EDIT.PHP <?php include   "conn.php" ;  // Using database connection file here $id = $_GET[ 'id' ];  // get id through query string $qry = mysqli_query($db, "select * from ab where id='$id'" );  // select query $data = mysqli_fetch_array($qry);  // fetch data if (isset($_POST[ 'update' ]))  // when click on Update button {     $fullname= $_POST[ 'fullname' ];     $age= $_POST[ 'age' ];     $mobile= $_POST[ 'mobile' ];     $date= $_POST[ 'date' ];     $email_id= $_POST[ 'email_id' ];     $address= $_POST[ 'address' ];     $state= $_POST[ 'state' ];     $gender= $_POST[ 'gender' ];     $h...

DELETE PAGE

 DELETE.PHP <?php include   "conn.php" ;  // Using database connection file here $id = $_GET[ 'id' ];  // get id through query string $del = mysqli_query($db, "delete from ab where id = '$id'" );  // delete query if ($del) {     mysqli_close($db);  // Close connection     header( "location:list.php" );  // redirects to all records page      exit ;    } else {     echo  "Error deleting record" ;  // display error message if not delete } ? >                                       ...