<?php 
include 'header.php';
    $id = $_GET['id'];
    $kdc= $_SESSION['kdc'];
    $kel = $_SESSION['kelurahan'];
    
    $sql2 = mysqli_query($koneksi, "SELECT nama,alamat,angg_no FROM anggota where angg_id='$id'");
        list($nama,$alamat,$angg_no) = mysqli_fetch_array($sql2);      
?>

<div class="container">

  <div class="my-2 border-bottom">
 <!--   <h2 class="fw-semibold fs-3">Profil</h2> -->
  </div>

  <section class="content">
    <div class="row justify-content-center">
      <section class="col-lg-5">       
        <div class="card card-info">

          <div class="card-header justify-content-between d-flex">
            <span class="card-title fw-semibold">Foto Diri Anggota <?php echo $kel ?> No : <?php echo $angg_no ?> </span>
            <a href="javascript:history.go(-1)" class="btn btn-primary btn-sm pull-right"><i class="bi bi-reply"></i> &nbsp; Kembali</a> 
          </div>
          <div class="card-body">
<div style="background-color: #DCDCDC; padding: 15px; border-radius: 15px; box-shadow: 0 0 15px rgba(0, 0, 0, 0.5);">               
            <form action="angg_foto_diri_act.php" method="post" enctype="multipart/form-data">
              <?php 
              $id = $_GET['id'];              
              $data = mysqli_query($koneksi, "select * from anggota where angg_id='$id'");
              while($d = mysqli_fetch_array($data)){
                  
                ?>
              <div class="form-group mb-2">
                <div class="form-group mb-2">
                  <input type="hidden" class="form-control" name="id" value="<?php echo $d['angg_id'] ?>" readonly="readonly">
                  <input type="hidden" class="form-control" name="tkdc" value="<?php echo $kdc ?>" readonly="readonly">
                </div>
                <div class="form-group mb-2">
                    
                    <center>
                    <?php if($d['foto_diri'] == ""){ ?>
                      <img src="../gambar/user.png" style="width: 50px;height: auto">
                      <font color='#ff0000'  style="text-align:left; font-size: 8pt; font-weight:normal;"><i>Belum ada foto....</i></font><br>
                    <?php }else{ ?>
                      <img src="../gambar/diri/<?php echo $d['foto_diri'] ?>" style="width: 270px;height: auto">
                    <?php } ?>
                    </center>
                    <input type="hidden" class="form-control" name="foto_diri_lama" value="<?php echo $d['foto_diri'] ?>" readonly required="required">
                </div>
                <div class="form-group mb-2">
                  <label class="form-label">Foto</label>
                  <input type="file" name="foto" class="form-control">
                  <p>Kosong Jika tidak ingin di ganti</p>
                </div>
              
                <div class="form-group mb-2">
                  <input type="submit" class="btn btn-primary" value="Simpan">
                  <font color='#ff0000'  style="text-align:left; font-size: 8pt; font-weight:normal;"><i>Jika ukuran foto terlalu besar, bisa jadi TIDAK BISA disimpan....</i></font><br>
                </div>
                <?php
              }

              ?>
              
            </form>
          </div>

        </div>
      </section>
    </div>
  </section>

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