<?php
include 'header.php';

if (isset($_GET['wallets'])) {
    $Editwallets = $_GET['wallets'];
  
    $sql = mysqli_query($link, "SELECT * FROM  wallets WHERE id = '$Editwallets' ");
      if (mysqli_num_rows($sql) > 0) {
      $row = mysqli_fetch_assoc($sql);
      $_wallet_name = $row['wallet_name'];  
      $_wallet_address = $row['wallet_address'];
    }
}

if (isset($_POST['submit'])) {

    $wallet_address = $_POST['wallet_address'];  


    $sql = mysqli_query($link, "UPDATE wallets  SET wallet_address = '$wallet_address'  WHERE id = '$Editwallets' ");

    if ($sql) {
      echo "<script>
      alert('updated successfully');
      window.location.href = 'wallets.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-sm-12 col-12">

      <!-- Card start -->
      <div class="card">
        <div class="card-header">
          <div class="card-title">Edit Wallet</div>
        </div>
        <div class="card-body">

          <!-- Row start -->
          <form method="POST" action="" >
          <div class="row">
            <div class="col-xxl-12 col-xl-12 col-lg-12 col-md-12 col-sm-12 col-12">
              <div class="mb-3">
                <label for="inputName" class="form-label">Department</label>
                <input type="text" class="form-control" id="inputName" name="department" value="<?php echo $_wallet_name ?>" readonly>
              </div>
            </div>
            <div class="col-xxl-12 col-xl-12 col-lg-12 col-md-12 col-sm-12 col-12">
              <div class="mb-3">
                <label for="inputEmail" class="form-label">wallet_address</label>
                <input type="text" class="form-control" id="inputEmail" name="wallet_address" value="<?php echo $_wallet_address   ?>" >
              </div>
            </div>
            
            </div>
            <button class="btn btn-success" name="submit" type="submit">Submit</button>

          <!-- Form actions footer end -->

          </form>

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

    </div>

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

</div>
<!-- Content wrapper end -->




<?php
include 'footer.php';
?>