<?php include 'inc/header.php';?>
<?php include 'inc/sidebar.php';?>
<?php include 'inc/navbar.php';?>
<?php

if(!empty($_POST)){

 $id = $_GET["id"]; 
 $option = $_POST['option']; 

 

  $update = $dbh->prepare("UPDATE selectable SET option = '".$option."' WHERE id = '".$id."'");
  $update->execute(); 
  foreach ($_POST["en"] as $key => $value) {
   dilguncelle("en","selectable",$id,$key,$value);
 }
}
?>

<?php
$sorgu = $dbh->prepare("SELECT * FROM selectable Where id=:id");
$sorgu->execute(['id' => (int)$_GET["id"]]);
$sonuc = $sorgu->fetch(); 
$sonucen = cevir("selectable",$sonuc,"en");   
?>   
<!-- Page Content-->
<div class="page-content">
  <div class="container-fluid">
    <!-- Page-Title -->

    <form method="post" action="" enctype="multipart/form-data">

      <div class="row">
        <div class="col-sm-12">
          <div class="page-title-box">
            <div class="row">
              <div class="col">
                <h4 class="page-title">Ek Seçenek Düzenle - <?=$sonuc['option'];?></h4>
                <ol class="breadcrumb">
                  <li class="breadcrumb-item"><a href="index.php">Anasayfa</a></li>
                  <li class="breadcrumb-item"><a href="secenek-liste.php">Ek Seçenek Listesi</a></li>
                  <li class="breadcrumb-item active">Ek Seçenek Düzenle</li>
                </ol>
              </div><!--end col-->
              <div class="col-auto align-self-center">
                <button class="btn btn-primary" type="submit">
                  <span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>
                  GÜNCELLE
                </button> 
              </div><!--end col-->  
            </div><!--end row-->                                                              
          </div><!--end page-title-box-->
        </div><!--end col-->
      </div><!--end row-->
      <!-- end page title end breadcrumb -->


      <div class="row">
        <div class="col-lg-12">
          <div class="card">
            <div class="card-header">
              <h4 class="card-title">Ek Seçenek Düzenle</h4>
              <p class="text-muted mb-0">Değerli kullanıcı, bu alandan ek seçenekleri düzeltebilirsiniz. Fiyatları ürün detay kısmından düzenleyip eklemeniz gerekmektedir.</p> 
            </div><!--end card-header-->
            <div class="card-body">

                <div class="row">

                    <div class="col-xl-12"> 
                  <div class="form-group">
                    <label for="exampleInputEmail1">Ek Seçenek Adı * </label>
                    <input type="text" class="form-control" id="exampleInputEmail1" aria-describedby="emailHelp" placeholder="Lütfen bir ek seçenek adı giriniz" name="option" value="<?=$sonuc['option'];?>" required=""> 
                  </div>
                </div>

                 
                 
              </div>



 

              <div class="row"> 
                    <div class="col-lg-12 col-xl-12">  
                      <div class="accordion" id="accordionExample">
                         
                  <div class="card mb-1 border shadow-none">
                    <div class="card-header  rounded-0" id="headingTwo">
                      <a href="" class="collapsed text-dark" data-toggle="collapse" data-target="#collapseTwo" aria-expanded="false" aria-controls="collapseTwo">
                        <i data-feather="sliders"></i> İngilizce Dil Ayarları
                      </a>
                    </div>
                    <div id="collapseTwo" class="collapse" aria-labelledby="headingTwo" data-parent="#accordionExample">
                      <div class="card-body">

                        <div class="form-group">
                          <label for="exampleInputEmail1">Ek Seçenek Adı * </label>
                        <input type="text" class="form-control" id="exampleInputEmail1" aria-describedby="emailHelp" placeholder="Lütfen bir ek seçenek adı giriniz" name="en[option]" value="<?=$sonucen['option'];?>">
                        </div>

                      

                        
                      </div>
                    </div>
                  </div> 
                </div>      
              </div><!--end col-->
            </div><!--end row-->
               

        <br>    
        <button class="btn btn-primary btn-block" type="submit">
          <span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>
          GÜNCELLE
        </button>
      </form>                                           
    </div><!--end card-body-->
  </div><!--end card-->
</div><!--end col-->


</div><!--end row-->



</div><!-- container -->

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

