<?php include('site-header.php'); ?>
  <!-- end of LOGO CONTAINER -->
  <!-- start of SIDEBAR        -->
  <?php include('left-nevigation.php'); ?>
  <!-- end of SIDEBAR          -->
  <!-- - - - - - - - - - - - - -->

  <main id="playground">

  <script src="ckeditor/ckeditor.js"></script>
    <!-- start of TOP NAVIGATION -->
     <?php include('site-top-header.php'); ?>
    <!-- - - - - - - - - - - - - -->
    <!-- end of TOP NAVIGATION   -->
    <!-- - - - - - - - - - - - - -->
    <!-- PAGE TITLE -->
<?php
  $edit_id =$_GET['edit'];
 extract($_POST);
?>

<?php
if(isset($insert))
{
   $sql_insert="INSERT INTO `tbl_withdrawn`(`name`, `address`, `reason`) 
                            VALUES ('$s_name','$s_address','$s_reason')";
  $data=mysqli_query($link,$sql_insert);
  if($data)
  {
      $msg = "<p style='color:green;'>Add  Successfully...</p>";
  }
  else
  {
      $msg = "<p style='color:red;'>Not Add...</p>";
  }
  
}
?>


<?php
if(isset($update))
{
  $sql_insert="UPDATE `tbl_withdrawn` SET 
                `name`='$s_name',
                `address`='$s_address',
                `reason`='$s_reason',
                `date`='$s_date'
                WHERE `id`=$s_id";
  $data=mysqli_query($link,$sql_insert);
  if($data)
  {
      $msg = "<p style='color:green;'>Update Successfully...</p>";
  }
  else
  {
      $msg = "<p style='color:red;'> Not Updated...</p>";
  }
  
}
?>


    <section id="page-title" class="row">
      <div class="col-md-8">
        <h1>Dashboard</h1>
        <p class="lead">Update your Withdrawn Organisation</strong>.</p>
        <?=@$msg;?>
      </div>
      <div class="col-md-4">
        <ol class="breadcrumb pull-right no-margin-bottom">
          <li><a href="dashboard.html">Dashboard</a></li>
          <li class="active">Update Withdrawn Organisation</li>
        </ol>

      </div>
    </section>
    <!-- / PAGE TITLE -->
    


    <?php
    $sqli ="SELECT * FROM `tbl_withdrawn` WHERE id=$edit_id";
    $data=mysqli_query($link,$sqli);
    $result=mysqli_fetch_array($data);
    $sn=0;
    
    $timestamp =$result['date'];
    ?>
    <div class="col-md-12">
      <div class="col-md-4">
        <a href="update-withdrawn.php" class="btn btn-primary">Back Withdrawn </a>
      </div>
      <div class="col-md-4">
        
      </div>
      <div class="col-md-4"></div>
      <div class="col-md-12">
        <div class="col-md-6">
        <form method="post">
          <label>Withdrawn Name:</label>
          <input type="text" name="s_name" value="<?php echo $result['name'] ?>" class="form-control" placeholder="Suspended Name">
          <label>Address</label>
          <input type="text" name="s_address" value="<?php echo $result['address'] ?>" class="form-control" placeholder="Withdrawn Address">
          <label>Reason</label>
          <input type="text" name="s_reason" value="<?php echo $result['reason'] ?>" class="form-control" placeholder="Withdrawn Reason">


          <?php $datetime = explode(" ",$timestamp);
                   $date = $datetime[0];
                  $time = $datetime[1]; ?>
          <label>Date Suspended</label>
          <input type="text" name="s_date" value="<?=$date; ?>" class="form-control" placeholder="Withdrawn Date">
          

          <input type="hidden" name="s_id" value="<?php echo $result['id'] ?>">
          <br>
          <?php
          if(isset($_GET['edit']))
          {
            ?>
            <input type="submit" name="update" value="Update" class="btn btn-primary">
            <?php
          }
          else
          {
             ?>
            <input type="submit" name="insert" value="add" class="btn btn-primary">
            <?php

          }
          ?>

        </form>
        
      </div>



          </div>
        </div>

    <!-- / container-fluid -->
 <script>

      CKEDITOR.replace(ckeditor1)  

    </script>
<?php include('site-footer.php'); ?>