<?php require 'ust.php'; ?>
<main id="main" class="main">
  <section class="section dashboard">
    <div class="row">
      <div class="col-12">
        <div class="card">
          <div class="card-body">
            <h5 class="card-title"> Paket Ekleme Paneli </h5>
            <form method="post">
              <div class="form-group my-3">
                <label for="exampleInputEmail1">Paket Adı</label>
                <input name="paket_adi" type="text" class="form-control">
              </div>
              <div class="form-group my-3">
                <label for="exampleInputEmail1">Paket Kredi Miktarı</label>
                <input name="paket_kredi" type="text" class="form-control">
              </div>
              <div class="form-group my-3">
                <label for="exampleInputEmail1">Paket Fiyatı ₺</label>
                <input name="paket_fiyat" type="text" class="form-control">
              </div>
              <button name="paketekle" type="submit" class="btn btn-primary">Kaydet</button>
            </form>
          </div>
        </div>
      </div>
    </div>
  </section>
</main>
<?php require 'footer.php'; ?>
<?php
if ($_POST) {
  $paket_adi = $_POST["paket_adi"];
  $paket_kredi = $_POST["paket_kredi"];
  $paket_fiyat = $_POST["paket_fiyat"];

  $ekle = mysqli_query($db, "INSERT INTO paketler(paket_adi,paket_kredi,paket_fiyat)VALUES('$paket_adi','$paket_kredi','$paket_fiyat')");
  if ($ekle) {
    echo '<script>swal("Başarılı", "Paket Başarılı Şekilde Eklendi ", "success");</script>';
    header("Refresh:2;url=paketliste.php");
  }else {
    echo '<script>swal("Hata!", " Beklenmedik Bir Hata Meydana Geldi Lütfen Tekrar Deneyin ", "error");</script>';
    header("Refresh:2;url=paketekle.php");
  }
}
 ?>
