SHARE
TWEET

aksi_edit.php

choirurrizal Feb 19th, 2017 58 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.     require_once('connect.php');
  3.     $q_id = $_GET['q_id'];
  4.     $sql = "select * from tabel_try where q_id = $q_id";
  5.     $query = mysql_query($sql);
  6.     $muncul = mysql_fetch_array($query);
  7.     $q_id = $muncul['q_id'];
  8.     $q_username = $muncul['q_username'];
  9.     $q_password = $muncul['q_password'];
  10. ?>
  11. <h3>data tabel_try</h3>
  12. <form method="POST" action="">
  13. <table border="1">
  14. <tr><td>q_id</td><td><input type="text" name="q_id" value="<?php echo $q_id; ?>" /></td></tr>
  15. <tr><td>q_username</td><td><input type="text" name="q_username" value="<?php echo $q_username; ?>" /></td></tr>
  16. <tr><td>q_password</td><td><input type="text" name="q_password" value="<?php echo $q_password; ?>" /></td></tr>
  17. <tr><td> </td><td><input type="submit" value="simpan" /></td></tr>
  18. </table>
  19. </form>
  20. <?php
  21.     if($_POST){
  22.         $q_id = $_POST['q_id'];
  23.         $q_username = $_POST['q_username'];
  24.         $q_password = $_POST['q_password'];
  25.         $simpan = mysql_query('update tabel_try set q_username="$q_username",$q_password="$q_password" where q_id="$q_id"') or die('gagal update');
  26.         if($simpan){
  27.             echo "berhasil update.. <a href='./aksi.php'>kembali kedata</a>";
  28.         }
  29.     }
  30. ?>
  31. <a href='./'>index</a> <a href='./form.php'>isi</a> <a href='./aksi.php'>aksi</a>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top