Guest User

prodi_update

a guest
Dec 2nd, 2019
169
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.  
  3. include_once("koneksi.php");
  4.  
  5.  
  6. if(isset($_POST['update']))
  7. {
  8. $prodi_id = $_POST['prodi_id'];
  9.  
  10. $prodi_nama=$_POST['prodi_nama'];
  11. $prodi_kode=$_POST['prodi_kode'];
  12. $prodi_ketua=$_POST['prodi_ketua'];
  13.  
  14.  
  15. $result = mysqli_query($mysqli, "UPDATE prodi SET prodi_nama='$prodi_nama',prodi_kode='$prodi_kode',prodi_ketua='$prodi_ketua' WHERE prodi_id=$prodi_id");
  16.  
  17. header("Location: prodi.php");
  18. }
  19. ?>
  20. <?php
  21.  
  22. $prodi_id = $_GET['prodi_id'];
  23.  
  24.  
  25. $result = mysqli_query($mysqli, "SELECT * FROM prodi WHERE prodi_id=$prodi_id");
  26.  
  27. while($prodi_data = mysqli_fetch_array($result))
  28. {
  29. $prodi_nama = $prodi_data['prodi_nama'];
  30. $prodi_kode = $prodi_data['prodi_kode'];
  31. $prodi_ketua = $prodi_data['prodi_ketua'];
  32. }
  33. ?>
  34. <!doctype html>
  35.  
  36. <html>
  37. <head>
  38. <meta charset="utf-8">
  39. <title>Untitled Document</title>
  40. <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
  41. <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.4.0/css/bootstrap.min.css" />
  42. <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.4.0/js/bootstrap.min.js"></script>
  43. </head>
  44.  
  45. <body>
  46. <?php
  47. include_once("nav.php");
  48. ?>
  49. <div class="container">
  50. <hr>
  51. <div class="alert alert-success" role="alert">
  52. <h5>Program Studi / Update Program Studi</h5>
  53. </div>
  54. <div class="table-responsive">
  55. <table width="75%" border="0" align="center" cellpadding="10" cellspacing="15">
  56. <tbody>
  57.  
  58. <tr>
  59. <td align="center">Ubah Data Program Sudi
  60. <br/><br/>
  61. <table width="75%" border="0" align="center" cellpadding="10" cellspacing="15">
  62. <tbody>
  63.  
  64.  
  65. <form name="update_user" method="post" action="prodi_update.php">
  66. <table width="80%" border="0" align="center" cellpadding="3" cellspacing="5">
  67. <tr>
  68. <td>Nama Program Studi</td>
  69. <td><input class="form-control" name="prodi_nama" type="text" value=<?php echo $prodi_nama;?> size="55"></td>
  70. </tr>
  71. <tr>
  72. <td>Kode Program Studi</td>
  73. <td><input class="form-control" name="prodi_kode" type="text" value=<?php echo $prodi_kode;?> size="5"></td>
  74. </tr>
  75. <tr>
  76. <td>Ketua Program Studi</td>
  77. <td><input class="form-control" name="prodi_ketua" type="text" value=<?php echo $prodi_ketua;?> size="55"></td>
  78. </tr>
  79. <tr>
  80. <td><input type="hidden" name="prodi_id" value=<?php echo $_GET['prodi_id'];?>></td>
  81. <td><input type="submit" name="update" value="Update"></td>
  82. </tr>
  83. </table>
  84. </form></td>
  85. </tr>
  86. </tbody>
  87. </table>
  88. </body>
  89. </html>
RAW Paste Data