Guest User

Untitled

a guest
Jul 31st, 2017
41
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.38 KB | None | 0 0
  1. <?php
  2.     $title = "Add User";
  3.     error_reporting(E_ALL);
  4.     include("php/HeaderMain.php");
  5.     require 'php/db_config.php';
  6.  
  7.     if(isset($_POST['Submit'])){
  8.  
  9.         $FirstName = !empty($_POST['FirstName']) ? $_POST['FirstName'] : '';
  10.         $LastName = !empty($_POST['LastName']) ? $_POST['LastName'] : '';
  11.         $EmailAddress = !empty($_POST['EmailAddress']) ? $_POST['EmailAddress'] : '';
  12.         $Username = !empty($_POST['Username']) ? $_POST['Username'] : '';
  13.         $Password = !empty($_POST['Password']) ? $_POST['Password'] : '';
  14.         $ConfirmPassword = !empty($_POST['ConfirmPassword']) ? $_POST['ConfirmPassword'] : '';
  15.        
  16.         $ErrorList = array();
  17.  
  18.         if($Password == $ConfirmPassword) {
  19.            
  20.  
  21.  
  22.         } else {
  23.             echo "NOT MATCH";
  24.  
  25.             $ErrorList[] = "Passwords must match.";
  26.  
  27.         }
  28.         echo "<br><br>";
  29.  
  30.         echo '<pre>'; print_r($ErrorList); echo '</pre>';
  31.     }
  32.  
  33. ?>
  34.     <div class="page-wrapper" id="edit-user">
  35.         <div class="container">
  36.             <div class="row">
  37.                 <div class="col-md-6 col-md-offset-3">
  38.                     <div class="jumbotron" style="padding: 50px;">
  39.  
  40.                     <div id="div_ErrorList" style="display: none;">
  41.                        
  42.                         Test
  43.                            
  44.                     </div>
  45.                      
  46.                         <h2 class="display-4">Add User</h2> <hr class="my-4"> <br>
  47.                             <form action="adduser.php" method="post" id="AddUser" role="form">
  48.                                 <div class="form-group row">
  49.                                      <label for="FirstName" class="col-1 col-form-label">First Name</label>
  50.                                      <div class="col">
  51.                                          <input class="form-control" type="text" name="FirstName" maxlength="40">
  52.                                      </div>
  53.                                 </div>
  54.                                 <div class="form-group row">
  55.                                      <label for="LastName" class="col-1 col-form-label">Last Name</label>
  56.                                      <div class="col">
  57.                                          <input class="form-control" type="text" name="LastName" maxlength="40">
  58.                                      </div>
  59.                                 </div>
  60.                                 <div class="form-group row">
  61.                                     <label for="EmailAddress" class="col-2 col-form-label">Email</label>
  62.                                     <div class="col">
  63.                                         <input class="form-control" type="email" name="EmailAddress" maxlength="60">
  64.                                     </div>
  65.                                 </div>
  66.                                 <div class="form-group row">
  67.                                      <label for="Username" class="col-1 col-form-label">Username</label>
  68.                                      <div class="col">
  69.                                          <input class="form-control" type="text" name="Username" maxlength="15">
  70.                                      </div>
  71.                                 </div>
  72.                                 <div class="form-group row">
  73.                                      <label for="Password" class="col-1 col-form-label">Password</label>
  74.                                      <div class="col">
  75.                                          <input class="form-control" type="password" name="Password" maxlength="15" id="Password">
  76.                                      </div>
  77.                                 </div>
  78.                                 <div class="form-group row">
  79.                                      <label for="ConfirmPassword" class="col-1 col-form-label">Confirm Password</label>
  80.                                      <div class="col">
  81.                                          <input class="form-control" type="password" name="ConfirmPassword" maxlength="15" id="ConfirmPassword">
  82.                                      </div>
  83.                                 </div>
  84.                                 <br>
  85.                                 <div class="center-align">
  86.                                     <button type="submit" class="btn btn-primary" name="Submit" onclick="ShowErrors()">Submit</button>
  87.                                 </div>
  88.                             </form>
  89.                     </div>
  90.                 </div>
  91.             </div>
  92.         </div>
  93.  
  94.         <?php
  95.             include("php/FooterMain.php");
  96.         ?>
  97.  
  98.         <script>
  99.  
  100.         function ShowErrors() {
  101.  
  102.             var FirstName = $('#FirstName').value;
  103.  
  104.             if (FirstName != ""){
  105.                 div_ErrorList.style.display="";
  106.             }
  107.  
  108.  
  109.         };     
  110.  
  111.         </script>
Add Comment
Please, Sign In to add comment