<?php 
session_start();
if(isset($_SESSION['unique_id'])){
  header("location: users.php");
}
include_once("header.php");

//fetch usertype from database
include("php/config.php"); 
$sql_usertype = mysqli_query($conn, "SELECT * FROM usertype WHERE `Status`='inactive'");
?>

<body >
  <div class="wrapper" style="min-width: 500px; max-width: 800px; width: 800px; margin-top: 60px;">
    <section class="form signup">
      <header>CREATE ACCOUNT</header>
      <form action="#" method="POST" enctype="multipart/form-data" autocomplete="off">
        <div class="error-text"></div>
        <div class="name-details">
          <div class="field input" style="width: 500px;">
            <label>First Name</label>
            <input type="text" name="fname" placeholder="First name" required>
          </div>
          <div class="field input" style="width: 500px;">
            <label>Last Name</label>
            <input type="text" name="lname" placeholder="Last name" required>
          </div>
        </div>
        <div class="custom-select wrap-input100 validate-input" style="width:100%;" data-validate="Select usertype">
						<select name="usertype" class="field input" style="width: 360px; border-color: white; border-radius: 5px; background-color: white; border: 2px solid #e8e8e8; height: 40px; font-size: 17px; margin-top: 5px; padding:5px;" required>
							<option value="">Select Office/Department :</option>
              <!-- Fetch the list of usertype in usertype table from database -->
              <?php
                $i=0;
                while($DB_ROW = mysqli_fetch_array($sql_usertype)) {
                ?>
                <option>
                <?php echo $DB_ROW["Department/Office"]; ?></option>
                <?php
                $i++;
                }
                ?>
						</select>
					</div>
        <div class="field input">
          <label>Email Address</label>
          <input type="text" name="email" placeholder="Enter your email" required>
        </div>
        <div class="field input">
          <label>Password</label>
          <input type="password" name="password" placeholder="Enter new password" required>
          <i class="fas fa-eye"></i>
        </div>
        <div class="field image">
          <label>Select Image</label>
          <input type="file" name="image" accept="image/x-png,image/gif,image/jpeg,image/jpg" required>
        </div>
        <div class="field button">
          <input type="submit" name="submit" value="Sign Up" style="background-color: green;">
        </div>
      </form>
      <div class="link">Already signed up? <a href="login.php">Login now</a></div>
    </section>
  </div>

  <script src="javascript/pass-show-hide.js"></script>
  <script src="javascript/signup.js"></script>

</body>
</html>
