Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <title>Your Details</title>
- <meta charset="utf-8">
- <link rel="stylesheet" href="css/common.css" type="text/css">
- <script src="script/myscript.js"></script>
- </head>
- <body onload="pload()">
- <img src="img/logo.png" alt="logo">
- <p id="date1">DATE</p>
- <p id="time1">TIME</p>
- <h3>Navigation</h3>
- <nav>
- <ul>
- <li><a href="home.html">Home</a></li>
- <li><a href="login.html">Login</a></li>
- <li><a href="addedit.php">New User</a></li>
- <li><a href="aboutus.html">About Us</a></li>
- <li><a href="contactus.html">Contact Us</a></li>
- </ul>
- </nav>
- <h1>Welcome to Shailesh Insurance</h1>
- <h2>Place to order </h2>
- <?php
- //declare all variables for db connection
- $dbserver="localhost:3307";
- $dbuser="root";
- $dbpassword="";
- $dbname="sbdb2019";
- //create connection
- $conn=new mysqli($dbserver,$dbuser,$dbpassword,$dbname);
- //check connection error
- if($conn->connect_error==true){
- die("connection failed error description $conn->connect_error");
- }else{
- echo "<p class='success'>Connection Success</p>";
- }
- //read login from values
- $name=$_POST['name'] ;
- $dob=date('Y-m-d',strtotime($_POST['dob']));
- $city=$_POST['city'];
- $phone=$_POST['phone'];
- $password1=$_POST['password1'];
- $password2=$_POST['password2'];
- //create sql statement
- $sql="INSERT INTO CUSTOMER(NAME,PHONE,CITY,DOB,PASSWORD)
- VALUES('$name','$phone','$city','$dob','$password1')";
- //execute sql and assign to result
- $result = $conn->query($sql);
- if($result==true){
- if($password1==$password2){
- echo "<h1 class=success>New user $name created successful.</h1>";
- }else{
- echo "<h1 class=fail>The two passwords don't match.</h1>";
- }
- }else{
- echo $conn->error;
- //echo "<h1 class=fail>Creating new user failed! $result->error</h1>";
- }
- ?>
- <footer>
- <p>Copyright© 2019 - All Rights Reserved</p>
- <p>Shailesh Bhandari</p>
- </footer>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement