Advertisement
Guest User

Untitled

a guest
Nov 10th, 2017
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.48 KB | None | 0 0
  1. <?php
  2.     include('ProjectOne/mysqlconnect.php');
  3.     // If the values are posted, insert them into the database.
  4.     if (isset($_POST['username']) && isset($_POST['password'])){
  5.         $username = $_POST['username'];
  6.        $email = $_POST['email'];
  7.         $password = $_POST['password'];
  8.  
  9.         $query = "INSERT INTO `Project 3` (Username, Password, Phone) VALUES ('$username', '$password', '$phone')";
  10.         $result = mysqli_query($connection, $query);
  11.         if($result){
  12.             $smsg = "User Created Successfully.";
  13.         }else{
  14.             $fmsg ="User Registration Failed";
  15.         }
  16.     }
  17.     ?>
  18. <html>
  19. <head>
  20.     <title>User Registeration Using PHP & MySQL</title>
  21.    
  22. <!-- Latest compiled and minified CSS -->
  23. <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" >
  24.  
  25. <!-- Optional theme -->
  26. <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" >
  27.  
  28. <link rel="stylesheet" href="styles.css" >
  29.  
  30. <!-- Latest compiled and minified JavaScript -->
  31. <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
  32. </head>
  33. <body>
  34.  
  35. <div class="container">
  36.       <form class="form-signin" method="POST">
  37.      
  38.       <?php if(isset($smsg)){ ?><div class="alert alert-success" role="alert"> <?php echo $smsg; ?> </div><?php } ?>
  39.       <?php if(isset($fmsg)){ ?><div class="alert alert-danger" role="alert"> <?php echo $fmsg; ?> </div><?php } ?>
  40.         <h2 class="form-signin-heading">Please Register</h2>
  41.         <div class="input-group">
  42.       <span class="input-group-addon" id="basic-addon1">@</span>
  43.       <input type="text" name="username" class="form-control" placeholder="Username" required>
  44.     </div>
  45.         <label for="inputEmail" class="sr-only">Email address</label>
  46.         <input type="email" name="email" id="inputEmail" class="form-control" placeholder="Email address" required autofocus>
  47.         <label for="inputPassword" class="sr-only">Password</label>
  48.         <input type="password" name="password" id="inputPassword" class="form-control" placeholder="Password" required>
  49.         <div class="checkbox">
  50.           <label>
  51.             <input type="checkbox" value="remember-me"> Remember me
  52.           </label>
  53.         </div>
  54.         <button class="btn btn-lg btn-primary btn-block" type="submit">Register</button>
  55.         <a class="btn btn-lg btn-primary btn-block" href="login.php">Login</a>
  56.       </form>
  57. </div>
  58.  
  59. </body>
  60.  
  61. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement