Advertisement
Guest User

updateadmin

a guest
Nov 24th, 2014
176
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.43 KB | None | 0 0
  1. <?php
  2. require_once("koneksi.php");
  3.  
  4. $query1 = mysql_query("select * from Admin where
  5. id_admin = '".$_GET['id_admin']."' ");
  6. while ($record = mysql_fetch_array($query1)) {
  7. ?>
  8.  
  9. <!DOCTYPE html>
  10. <html>
  11. <head>
  12. <style type="text/css"> .style{color: #FFFFFF} </style>
  13. <title> Update Admin</title>
  14. </head>
  15. <body>
  16. <h3> Update Admin </h3>
  17. <form action="" method="post" >
  18. <fieldset>
  19. <table width="200" border="0">
  20. <tr>
  21. <td> Id </td>
  22. <td><input name="id" type="text" readonly="readonly"
  23. value="<?php echo $record['id_admin'];?>"></td>
  24. </tr>
  25. <tr>
  26. <td> Username </td>
  27. <td><input name="username" type="text"
  28. value="<?php echo $record['username'];?>"></td>
  29. </tr>
  30. <tr>
  31. <td> Password </td>
  32. <td><input name="password" type="password" id="password"
  33. value="<?php echo $record['password'];?>"></td>
  34. </tr>
  35. <tr>
  36. <td><colspan="2"><input name="submit" type="submit"
  37. value="Update" id="update"> </td>
  38. </tr>
  39.  
  40. </table>
  41. <?php
  42. }
  43. ?>
  44. </fieldset>
  45. </form>
  46. </body>
  47. </html>
  48.  
  49. <?php
  50. if (isset($_POST['update'])) {
  51. $query = "UPDATE `Admin` SET `username` = '".$_POST['username']."',
  52. `password` = '".$_POST['password']."' WHERE
  53. `Admin`.`id_admin` = '".$_POST['id']."';";
  54.  
  55. $hasil = mysql_query($query) or die (mysql_error());
  56.  
  57. ?>
  58. <script>
  59. alert("data sukses di Update");
  60. window.location = 'dataadmin.php';
  61. </script>
  62.  
  63. <?php
  64. }
  65. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement