Advertisement
Guest User

ubah_form

a guest
Jul 4th, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.39 KB | None | 0 0
  1. <?php
  2. # MEMBUAT KONEKSI DATABASE
  3. // Definisi Variabel Untuk Koneksi
  4. $host = "localhost"; // Nama Host
  5. $user = "root"; // Nama user
  6. $pass = ""; // Password
  7. $db = "biodata"; // Nama Database
  8.  
  9. // Melakukan Koneksi Ke Database MYSQL
  10. $mysql = new mysqli($host, $user, $pass, $db);
  11.  
  12. /* check koneksi */
  13. if (mysqli_connect_error()) {
  14. printf("Connect failed: %s\n", mysqli_connect_error());
  15. exit();
  16. }
  17. $iddata=$_GET['iddata'];
  18. $SQL_Data = $mysql->query(" SELECT * FROM biodata WHERE iddata='$iddata'");
  19. $biodata = $SQL_Data->fetch_array();
  20. ?>
  21. <html>
  22. <head>
  23. <title>Biodata</title>
  24. <style>
  25. input[type=text], select {
  26. width: 100%;
  27. padding: 8px 12px;
  28. margin: 5px 0;
  29. margin-left:10px;
  30. display: inline-block;
  31. border: 1px solid #ccc;
  32. border-radius: 4px;
  33. box-sizing: border-box;
  34. }
  35. input[type=radio], input[type=checkbox]{
  36. margin-left:10px;
  37. }
  38. input[type=submit] {
  39. width: 100%;
  40. background-color: #4CAF50;
  41. color: white;
  42. font-size:15px;
  43. padding: 14px 20px;
  44. margin: 8px 0;
  45. border: none;
  46. border-radius: 4px;
  47. cursor: pointer;
  48. }
  49.  
  50. input[type=submit]:hover {
  51. background-color: #45a049;
  52. }
  53. body {
  54. background-color: #E6E6FA;
  55. }
  56. h2{
  57. text-align:center;
  58. color:#4CAF50;
  59. text-shadow: 2px 2px 5px white;
  60. }
  61.  
  62. </style>
  63. </head>
  64. <body>
  65. <h2>Ubah Biodata</h2>
  66. <form action="hasl_ubah_data.php" method="post">
  67. <table align="center" >
  68. <tr>
  69. <td>Nama</td>
  70. <td>:</td>
  71. <td><input type="text" name="nama" value="<?php echo $biodata['nama'];?>"><input type="hidden" name="iddata" value="<?php echo $biodata['iddata'];?>"></td>
  72. </tr>
  73. <tr>
  74. <td>Tanggal Lahir</td>
  75. <td>:</td>
  76. <td><input type="text" name="tanggallahir" value="<?php echo $biodata['tanggallahir'];?>"></td>
  77. </tr>
  78. <td>Jenis Kelamin
  79. <td>
  80. <input type="radio" name="jeniskelamin" value="laki-laki" checked> Lelaki
  81. <input type="radio" name="jeniskelamin" value="perempuan"> Perempuan</td>
  82. </td>
  83. <tr>
  84. <td>Alamat</td>
  85. <td>:</td>
  86. <td><input type="text" name="alamat" value="<?php echo $biodata['alamat'];?>"></td>
  87. </tr>
  88. <tr>
  89. <td>No Telpon</td>
  90. <td>:</td>
  91. <td><input type="text" name="notelp" value="<?php echo $biodata['notelp'];?>"></td>
  92. </tr>
  93. <tr>
  94. <td colspan="3"><input type="submit" value="UBAH"></td>
  95. </tr>
  96.  
  97. </table>
  98. </form>
  99. </body>
  100. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement