Advertisement
NetCut

valid

Feb 25th, 2019
185
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.10 KB | None | 0 0
  1. <?php
  2. if( empty( $_SESSION['id_user'] ) ){
  3. $_SESSION['err'] = '<strong>ERROR!</strong> Anda harus login terlebih dahulu.';
  4. header('Location: ./');
  5. die();
  6. } else {
  7. if( isset( $_REQUEST['aksi11'] )){
  8. $aksi1 = $_REQUEST['aksi1'];
  9. switch($aksi1){
  10. case 'hapus':
  11. include 'sub_hapus.php';
  12. break;
  13. }
  14. }
  15. if( isset( $_REQUEST['submit'] )){
  16. $setuju = $_REQUEST['setuju'];
  17. $id_sub = $_REQUEST['id_sub'];
  18. $sql = mysqli_query($koneksi, "UPDATE sub SET setuju='$setuju' WHERE id_sub='$id_sub'");
  19. if ($sql == true) {
  20. echo 'berhasil';
  21. die();
  22. } else {
  23. echo 'ERROR! Periksa penulisan querynya';
  24.  
  25. }
  26. }else {
  27. $nota = $_REQUEST['nota'];
  28. $sql3 = mysqli_query($koneksi, "SELECT * from transaksi where nota='$nota'");
  29. $row2 = mysqli_fetch_array($sql3)
  30. ?>
  31. <form method="post" action="" class="form-inline" role="form">
  32. <div ><br></div>
  33. <div class="form-group">
  34. <?php
  35. ?>
  36.  
  37. <label for="nota" class="col-sm-2 control-label">No. Nota</label>
  38. <div class="col-sm-2"><div class="col-sm-2">
  39. <input type="text" name="nota" id="nota" class="form-control" value="<?php echo $row2['nota']?>" readonly>
  40. </div>
  41. </div>
  42.  
  43. <div class="pull-right">
  44.  
  45. <label for="koordinator" class="col-sm-4 control-label">Koordinator</label>
  46. <div class="col-sm-4">
  47. <h3>
  48. <?php echo $_SESSION['koordinator']; ?>
  49.  
  50. </h3>
  51. </div>
  52. </div>
  53. </div>
  54. <div class="pull-right">
  55.  
  56. <form action="" method="post" role="form" class="form-inline">
  57. <button class="btn btn-primary pull-right" name="submit" id="submit">Valid</button>
  58. </div>
  59.  
  60. <form method="post" action="" class="form-inline" role="form">
  61. <hr>
  62. <div ><input type="text" class="hidden" name="id_sub" id="id_sub"></div>
  63.  
  64. <div >
  65.  
  66. <table class="table table-bordered">
  67. <thead>
  68. <tr class="info">
  69. <th width="5%">No</th>
  70. <th width="10%">Kode Barang</th>
  71. <th width="22%">Nama Barang</th>
  72. <th width="10%">Jenis</th>
  73. <th width="10%">satuan</th>
  74. <th width="10%">permintaan</th>
  75. <th width="10%">Disetujui</th>
  76. <th width="20%">Tindakan</th>
  77. </tr>
  78. </thead>
  79.  
  80. <tbody>
  81. <?php
  82. $nota = $_REQUEST['nota'];
  83. $sql = mysqli_query($koneksi, "SELECT * FROM sub where nota='$nota'");
  84. if(mysqli_num_rows($sql) > 0){
  85. $no = 0;
  86.  
  87. while($row = mysqli_fetch_array($sql)){
  88. $no++;
  89. echo '
  90.  
  91. <tr>
  92. <td>'.$no.'</td>
  93. <td>'.$row['id_barang'].'</td>
  94. <td>'.$row['nama_barang'].'</td>
  95. <td>'.$row['jenis_barang'].'</td>
  96. <td>'.$row['satuan'].'</td>
  97. <td>'.$row['permintaan'].'</td>
  98. <td>
  99. <input type="number" class="form-control " value="'.$row['setuju'].'" name="setuju" id="setuju">
  100. </td>
  101. <td>';
  102. echo'
  103.  
  104.  
  105. <script type="text/javascript" language="JavaScript">
  106. function konfirmasi(){
  107. tanya = confirm("Anda yakin akan menghapus data ini?");
  108. if (tanya == true) return true;
  109. else return false;
  110. }
  111. </script>
  112. <a href="?hlm=transaksi&aksi=baru&aksi1=hapus&submit=yes&id_sub='.$row['id_sub'].'" onclick="return konfirmasi()" class="btn btn-danger btn-s">Hapus</a>
  113. </td>';
  114. }
  115. }
  116.  
  117. ?>
  118.  
  119. </tr>
  120.  
  121. </tbody>
  122.  
  123. </div>
  124. </form>
  125. </div>
  126.  
  127. </form>
  128.  
  129.  
  130.  
  131.  
  132.  
  133. <?php
  134. }
  135. }
  136. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement