<?php 
  include 'header.php';


  
  if (isset($_GET['plans'])) {
    $Dplans = $_GET['plans'];
    $sql = mysqli_query($link, "DELETE FROM plans WHERE id = '$Dplans' ");
   if ($sql) {

  }
}

?>

<!-- Card start -->
     <div class="card">
                  <div class="card-header">
                    <div class="card-title"></div>
                  </div>
                  <div class="card-body">
                    <div class="table-responsive">
                      <table id="scrollVertical" class="table custom-table">
                        <thead>
                          <tr>
                            <th>#</th>
                            <th>Plan Name</th>
                            <th>Min Amoun</th>
                            <th>Max Amount</th>
                            <th>Profit Percentage</th>
                            <th>Interval Period</th>
                       
                            <th>Status</th>
                            <th>Action</th>
                            <th>Action</th>
                          </tr>
                        </thead>
                        <tbody>
                 <?php
                      $i = 0;
                        $select = mysqli_query($link, "SELECT * FROM  plans   ");
                          if (mysqli_num_rows($select) > 0) {
                            while ($row = mysqli_fetch_assoc($select)) {
                              $id = $row ['id'];
                             
                     $i++         
                   ?>  
                          <tr>
                            <td><?php echo $i  ?></td>
                            <td><?php echo $row['plan_name']  ?></td>
                            <td>$<?php echo $row['min_amount']  ?></td>
                            <td>$<?php echo $row['max_amount']  ?></td>	
                            <td><?php echo $row['profit_percentage']?>%</td>
                            <td><?php echo $row['interval_period']?>days</td>
                            
                            <td><?php echo $row['plan_status']?></td>


                            <td>
                               <a class="btn btn-sm btn-success" style="color: white;" href="editplans.php?plans=<?php echo $id  ?>">Edit</a>
                            </td>

                           <td>
                               <a class="btn btn-sm btn-danger" style="color: white;" href="viewplans.php?plans=<?php echo $id  ?>">Delete</a>
                          </td>

                        </tr>
                    
                      <?php }} ?>
                      </tbody>
                  </table>
              </div>
          </div>
      </div>
  </div>
<?php
    include 'footer.php';
?>