Advertisement
Guest User

slesh

a guest
Feb 10th, 2019
183
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.70 KB | None | 0 0
  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=date('Y-m-d',strtotime($_POST['dob']));
  44. $city=$_POST['city'];
  45. $phone=$_POST['phone'];
  46. $password1=$_POST['password1'];
  47. $password2=$_POST['password2'];
  48. //create sql statement
  49.  
  50. $sql="INSERT INTO CUSTOMER(NAME,PHONE,CITY,DOB,PASSWORD)
  51. VALUES('$name','$phone','$city','$dob','$password1')";
  52. //execute sql and assign to result
  53. $result = $conn->query($sql);
  54. if($result==true){
  55. if($password1==$password2){
  56. echo "<h1 class=success>New user $name created successful.</h1>";
  57. }else{
  58. echo "<h1 class=fail>The two passwords don't match.</h1>";
  59. }
  60. }else{
  61. echo $conn->error;
  62. //echo "<h1 class=fail>Creating new user failed! $result->error</h1>";
  63. }
  64. ?>
  65. <footer>
  66. <p>Copyright&copy; 2019 - All Rights Reserved</p>
  67. <p>Shailesh Bhandari</p>
  68. </footer>
  69. </body>
  70. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement