<?php
defined("BASEPATH") or exit("No direct access allowed");
?>
<div class="card-header">
					
          <nav aria-label="breadcrumb">
                      <ol class="breadcrumb bg-warning text-white-all">
                        <li class="breadcrumb-item"><a href="#"><i class="fas fa-tachometer-alt"></i> Home</a></li>
                        <li class="breadcrumb-item"><a href="index.php?page=unsub"><i class="far fa-file"></i> Alasan</a></li>
                        <li class="breadcrumb-item active" aria-current="page"><i class="fas fa-list"></i> Edit</li>
                      </ol>
                    </nav>

    
 <?php 

if (isset($_POST['ubah'])){
          
            $id = $_POST['id'] ;
            $p1 = mysqli_real_escape_string($con,$_POST['p1']);
            $p2 = mysqli_real_escape_string($con,$_POST['p2']);

            mysqli_query($con,"update alasan set alasan='$p1',link='$p2' where id='".$_GET['id']."'");
            
               echo '
    		<!-- <div class="alert alert-success alert-dismissable" style="margin-top:20px">
                <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
                <h4><i class="icon glyphicon glyphicon-remove"></i> Data Berhasil Diubah
                </div> -->
                ';
               
               echo "
                   <!-- <div class='container'>
                     <form class='form-horizontal' role='form' action='index.php?page=emailsender' method='POST'>
                       <button type='submit' class='btn btn-primary'><span class='glyphicon glyphicon-log-out'></span> Kembali</button>
                     </form>
                   </div> -->
                   
               <script>
        	        swal('Good Job','berhasil mengubah data email sender','success');
                </script>
                
                <script language='JavaScript'>document.location='index.php?page=unsub'</script>
            
            "
            
               ;
             
}
?>
   
 <?php 
    
      $tampil=mysqli_fetch_row(mysqli_query($con,"select * from alasan where id='".$_GET['id']."'"));
      
      

   ?>   

<div class="card-body">            

    <div class="container">
      <form action="" method="POST">
            <input type="hidden" name="id" value="<?php echo $tampil['id']; ?>">
      <div class="container">
      <form action="" method="POST">
        <div class="form-group">  
          <p><label>Alasan</label><input type="text" name="p1" class="form-control" value="<?php echo $tampil[1]; ?>"></p>
        </div> 
        <div class="form-group">  
          <p><label>Link Penawaran Lain</label><input type="text" name="p2" class="form-control" value="<?php echo $tampil[2]; ?>"></p>
        </div>
        <div class="form-group">
          <div class  ="col-sm-4">
            <button type="submit" class="btn btn-primary" name="ubah"><span class="glyphicon glyphicon-pencil"></span> Ubah Alasan</button>
          </div>
        </div>
      </form>
    </div>
</div></div>
    