<?php
defined("BASEPATH") or exit("No direct access allowed");
if (isset($_POST['simpan'])){
    if (!empty($_POST['e1'])) {
    	$e1 = mysqli_real_escape_string($con,$_POST['e1']);
        $e2 = mysqli_real_escape_string($con,$_POST['e2']);
    	mysqli_query($con,"INSERT INTO alasan VALUE (NULL,'".$e1."','".$e2."')");
    	
    	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 Disimpan
                    </div> -->
            
             <script>
            	        swal("Good Job","berhasil menyimpan data alasan","success");
                    </script>        
                    
                    <script language="JavaScript">document.location="index.php?page=unsub"</script>
                    ';
    
    } else {
    	
    	echo "<div class='alert alert-warning 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> alasan harus diisi
                </div>";
    }

}
?>
<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> Baru</li>
                      </ol>
                    </nav>
                    
          </div>
<div class="card-body">		  


<form action="" method="post">
<p><label>Alasan</label><input type="text" name="e1" maxlength="250" class="form-control" placeholder="Contoh: Pengen unsub saja" required/></p>
<p><label>Link Penawaran Lain</label><input type="text" name="e2" maxlength="250" class="form-control" placeholder="Contoh: https://biznis.top" required/></p>
<input class="btn btn-secondary btn-border" type="submit" name="simpan" value="Simpan"/>
</form>
</div>