SHARE
TWEET

slesh

a guest Feb 10th, 2019 239 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <!DOCTYPE html>
  2. <html lang="en">
  3.     <head>
  4.         <title>Your Details</title>
  5.         <meta charset="utf-8">
  6.         <link rel="stylesheet" href="css/common.css" type="text/css">
  7.         <script src="script/myscript.js"></script>
  8.      </head>
  9.     <body onload="pload()">
  10.         <img src="img/logo.png" alt="logo">
  11.         <p id="date1">DATE</p>
  12.         <p id="time1">TIME</p>
  13.         <h3>Navigation</h3>
  14.         <nav>
  15.             <ul>
  16.                 <li><a href="home.html">Home</a></li>
  17.                 <li><a href="login.html">Login</a></li>
  18.                 <li><a href="addedit.php">New User</a></li>
  19.                 <li><a href="aboutus.html">About Us</a></li>
  20.                 <li><a href="contactus.html">Contact Us</a></li>
  21.                
  22.             </ul>
  23.         </nav>
  24.         <h1>Welcome to Shailesh Insurance</h1>
  25.         <h2>Place to order </h2>
  26.        
  27.         <?php
  28.         //declare all variables for db connection
  29.             $dbserver="localhost:3307";
  30.             $dbuser="root";
  31.             $dbpassword="";
  32.             $dbname="sbdb2019";
  33.         //create connection
  34.             $conn=new mysqli($dbserver,$dbuser,$dbpassword,$dbname);
  35.         //check connection error
  36.             if($conn->connect_error==true){
  37.                 die("connection failed error description $conn->Connect_error");
  38.             }else{
  39.                 echo "<p class='success'>Connection Success</p>";
  40.             }
  41.                 //read login from values
  42.                 $name=$_POST['name'] ;
  43.                 $dob=$_POST['dob'];
  44.                 $city=$_POST['city'];
  45.                 $phone=$_POST['phone'];
  46.                 $password=$_POST['password'] ;
  47.                 //create sql statement
  48.                 $sql="INSERT INTO CUSTOMER(NAME,PHONE,CITY,DOB,PASSWORD)
  49.                     VALUES('$name','$phone','$city','$dob','$password')";
  50.                 //execute sql and assign to result
  51.                 $result = $conn->query($sql);
  52.                 if($result->num_rows>0){
  53.                     //display welcome
  54.                     echo "<pre><h1>Welcome $name your details are below</h1></pre>";
  55.                     echo "<h2>Please enter new details except id if you need changes</h2>";
  56.                     echo "<form method = 'post' action = 'update.php'>";
  57.                     //create table to display information
  58.                     echo "<table>";
  59.                     while($row=$result->fetch_assoc()){
  60.                         echo "<tr><td>ID:</td><td><input type='number' id='box' name='id' readonly value=".$row['ID']."></td></tr>";
  61.                         echo "<tr><td>Name:</td><td><input type='text' id='box' name='name' value=".$row['NAME']."></td></tr>";
  62.                         echo "<tr><td>City:</td><td><input type='text' id='box' name='city' value=".$row['CITY']."></td></tr>";
  63.                         echo "<tr><td>DOB:</td><td><input type='date' id='box' name='dob' value=".$row['DOB']."></td></tr>";
  64.                         echo "<tr><td>Phone:</td><td><input type='phone' id='box' name='phone' value=".$row['PHONE']."></td></tr>";
  65.                         echo "<tr><td>Password:</td><td><input type='text' id='box' name='password' value=".$row['PASSWORD']."></td></tr>";
  66.                         echo "<tr><td colspan=2><input type=submit value=UPDATE class=btn></td></tr>";
  67.                     }
  68.                     echo "</table>";
  69.                     echo "</form>";
  70.                     //close db connection
  71.                     $conn->close();
  72.                 }else{
  73.                     echo "<p class='fail'>You are not authorised to access this information</p>";
  74.                 }
  75.         ?>
  76.         <footer>
  77.             <p>Copyright&copy; 2019 - All Rights Reserved</p>
  78.             <p>Shailesh Bhandari</p>
  79.         </footer>
  80.     </body>
  81. </html>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top