<?php
include 'header.php';

if (isset($_POST['submit'])) {
	$planname = text_input($_POST['Plan_Name']);
	$Min_Amoun = text_input($_POST['Min']);
	$Max_Amount = text_input($_POST['Max']);
	$Profit_Percentage = text_input($_POST['Profit']);
	$interval_period = text_input($_POST['interval_period']);
	$time_period = text_input($_POST['time_period']);



    $insert = mysqli_query($link, "INSERT INTO plans (plan_name, min_amount, max_amount, profit_percentage,interval_period,time_period  ) VALUES ('$planname', '$Min_Amoun', '$Max_Amount', '$Profit_Percentage', '$interval_period', '$time_period'  )");

    echo  "<script>
            alert('Plan Added Successfully');
            window.location.href = 'viewplans.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">Add Plans</div>
        </div>
        <div class="card-body">

          <!-- Row start -->
          <form method="POST" action="" >
          <div class="row">
            <div class="col-xxl-6 col-xl-12 col-lg-6 col-md-6 col-sm-6 col-6">
              <div class="mb-3">
                <label for="inputName" class="form-label">Plan Name </label>
                <input type="text" class="form-control" id="inputName" name="Plan_Name" value="">
              </div>
            </div>

            <div class="col-xxl-6 col-xl-12 col-lg-6 col-md-6 col-sm-6 col-6">
              <div class="mb-3">
                <label for="inputEmail" class="form-label">Min Amount</label>
                <input type="text" class="form-control" id="inputEmail" name="Min" value="" >
              </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">Max Amount</label>
                <input type="text" class="form-control" id="inputEmail" name="Max" value="" >
              </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">Profit Percentage</label>
                <input type="text" class="form-control" id="inputEmail" name="Profit" value="" >
              </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">Interval Period</label>
                <input type="text" class="form-control" id="inputEmail" name="interval_period" value="" >
              </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">Time Period</label>
                <input type="text" class="form-control" id="inputEmail" name="time_period" value="" >
              </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';
?>