<?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=qrc"><i class="far fa-file"></i> QRCode</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']);
            $p3 = mysqli_real_escape_string($con,$_POST['p3']);
            $pesan1 = mysqli_real_escape_string($con,$_POST['pesan1']);
            
                //simpan
                 mysqli_query($con,"update qrcode set judulqr='$p1', ketqr='$p2',tglexqr='$p3',pesan1='$pesan1' where id='$id'"); 
                
    	echo '
             <script>
            	        swal("Good Job","berhasil menyimpan data","success");
                    </script>        
                    
                    <script language="JavaScript">document.location="index.php?page=qrc"</script>
                    ';
            
}
?>
   
 <?php 
    
      $tampil=mysqli_fetch_row(mysqli_query($con,"select * from qrcode where id='".$_GET['id']."'"));
      
      

   ?>   

<div class="card-body">            

    <div class="container">
      <form action="" method="POST" enctype="multipart/form-data">
            <input type="hidden" name="id" value="<?php echo $tampil[0]; ?>">
      <div class="container">
      <form action="" method="POST">
        <div class="form-group">  
          <p><label>Judul Qrcode</label><input type="text" name="p1" class="form-control" value="<?php echo $tampil[2]; ?>" required/></p>
        </div> 
        <div class="form-group">  
          <p><label>Keterangan Qrcode</label><input type="text" name="p2" class="form-control" value="<?php echo $tampil[3]; ?>" required/></p>
        </div>
        <div class="form-group">  
          <p><label>Tgl.Masa Aktif QRCode</label><input type="date" name="p3" class="form-control" value="<?php echo $tampil[4]; ?>" required/></p>
        </div>
        
        <div class="form-group">  
            <p>Pesan dari Pemilik/Panitia ke Prospek saat Validasi QRCode.<br><i>Pakai tag [judul], [nama], [email]</i></p>
            <textarea name="pesan1" cols="20" class='ckeditor' required>
            <?php echo $tampil[7]; ?> 
        </textarea>
        </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 Qrcode</button>
          </div>
        </div>
      </form>
    </div>
</div></div>
    