<?php
include 'header.php';

       $sql = mysqli_query($link, "SELECT * FROM  admin ");
          if (mysqli_num_rows($sql) > 0) {
              $row = mysqli_fetch_assoc($sql);
              $_email = $row['email'];
              $_password = $row['password'];
         }

            if (isset($_POST['submit'])) {
             $email = $_POST['email'];
             $password = $_POST ['password'];
           
             $sql = mysqli_query($link, "UPDATE admin SET email = '$email', password = '$password'  ");

              if ($sql) {
                echo "<script>
                  alert('Setting Updated');
                  window.location.href = 'accountsettings.php';
                </script>";
              }
            }
?>


        <!-- Content wrapper scroll start -->
        <div class="content-wrapper-scroll">

          <!-- Content wrapper start -->
          <div class="content-wrapper">

            <!-- Row start -->
            <div class="row">
              <div class="col-xl-12">
                <!-- Card start -->
                <div class="card">
                  <div class="card-body">

                    <!-- Row start -->
                    <div class="row">
                      <div class="col-xxl-8 col-lg-7 col-md-6 col-sm-12 col-12">
                       <form method="POST" action="accountsettings.php">
                        <div class="row">
                          <div class="col-xxl-4 col-sm-6 col-12">
                            <!-- Form Field Start -->
                            <div class="mb-3">
                              <label for="username" class="form-label">Email</label>
                              <input type="username" class="form-control" id="username" placeholder="email" name="email" value="<?php echo $_email ?>">
                            </div>
                          </div>
                          <div class="col-xxl-4 col-sm-6 col-12">
                            <!-- Form Field Start -->
                            <div class="mb-3">
                              <label for="password" class="form-label">Password</label>
                              <input type="password" class="form-control" id="Password" placeholder="Password" name="password" value="<?php  echo $_password ?>">
                            </div>
                          </div>
                        </div>
                      </div>
                   
                         
                      <div class="col-sm-12 col-12">
                        <hr>
                        <button class="btn btn-info" type="submit" name="submit">Save Settings</button>
                      </div>
                    </div>
                    <!-- Row end -->
                      </form>


                  </div>
                </div>
                <!-- Card end -->
              </div>
            </div>
            <!-- Row end -->

          </div>
          <!-- Content wrapper end -->
          
<?php
  include 'footer.php';
?>