Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- # MEMBUAT KONEKSI DATABASE
- // Definisi Variabel Untuk Koneksi
- $host = "localhost"; // Nama Host
- $user = "root"; // Nama user
- $pass = ""; // Password
- $db = "biodata"; // Nama Database
- // Melakukan Koneksi Ke Database MYSQL
- $mysql = new mysqli($host, $user, $pass, $db);
- /* check koneksi */
- if (mysqli_connect_error()) {
- printf("Connect failed: %s\n", mysqli_connect_error());
- exit();
- }
- $iddata=$_GET['iddata'];
- $SQL_Data = $mysql->query(" SELECT * FROM biodata WHERE iddata='$iddata'");
- $biodata = $SQL_Data->fetch_array();
- ?>
- <html>
- <head>
- <title>Biodata</title>
- <style>
- input[type=text], select {
- width: 100%;
- padding: 8px 12px;
- margin: 5px 0;
- margin-left:10px;
- display: inline-block;
- border: 1px solid #ccc;
- border-radius: 4px;
- box-sizing: border-box;
- }
- input[type=radio], input[type=checkbox]{
- margin-left:10px;
- }
- input[type=submit] {
- width: 100%;
- background-color: #4CAF50;
- color: white;
- font-size:15px;
- padding: 14px 20px;
- margin: 8px 0;
- border: none;
- border-radius: 4px;
- cursor: pointer;
- }
- input[type=submit]:hover {
- background-color: #45a049;
- }
- body {
- background-color: #E6E6FA;
- }
- h2{
- text-align:center;
- color:#4CAF50;
- text-shadow: 2px 2px 5px white;
- }
- </style>
- </head>
- <body>
- <h2>Ubah Biodata</h2>
- <form action="hasl_ubah_data.php" method="post">
- <table align="center" >
- <tr>
- <td>Nama</td>
- <td>:</td>
- <td><input type="text" name="nama" value="<?php echo $biodata['nama'];?>"><input type="hidden" name="iddata" value="<?php echo $biodata['iddata'];?>"></td>
- </tr>
- <tr>
- <td>Tanggal Lahir</td>
- <td>:</td>
- <td><input type="text" name="tanggallahir" value="<?php echo $biodata['tanggallahir'];?>"></td>
- </tr>
- <td>Jenis Kelamin
- <td>
- <input type="radio" name="jeniskelamin" value="laki-laki" checked> Lelaki
- <input type="radio" name="jeniskelamin" value="perempuan"> Perempuan</td>
- </td>
- <tr>
- <td>Alamat</td>
- <td>:</td>
- <td><input type="text" name="alamat" value="<?php echo $biodata['alamat'];?>"></td>
- </tr>
- <tr>
- <td>No Telpon</td>
- <td>:</td>
- <td><input type="text" name="notelp" value="<?php echo $biodata['notelp'];?>"></td>
- </tr>
- <tr>
- <td colspan="3"><input type="submit" value="UBAH"></td>
- </tr>
- </table>
- </form>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement