Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <h2 class="text-center">Edit Data Diri</h2>
- <hr>
- <?php
- $koneksi = new mysqli("localhost","root","","first");
- ?>
- <form method="get">
- <?php $ambil=$koneksi->query("SELECT * FROM pelanggan"); ?>
- <?php $pecah=$ambil->fetch_assoc() ?>
- <div class="form-group">
- <label>Nama</label>
- <input type="text" name="nama" class="form-control" value="<?php echo $pecah['nama']; ?>">
- </div>
- <div class="form-group">
- <label>Username</label>
- <input type="text" name="username" class="form-control" value="<?php echo $pecah['username']; ?>">
- </div>
- <div class="form-group">
- <label>Password</label>
- <input type="text" name="password" class="form-control" value="<?php echo $pecah['password']; ?>">
- </div>
- <button class="btn btn-success" name="ubah">Ubah</button>
- </form>
- <?php
- if (isset($_POST['ubah'])) {
- $koneksi->query("UPDATE pelanggan SET nama='$_POST[nama]', username='$_POST[username]', password='$_POST[password]' WHERE nama='$_GET[nama]'");
- echo "<script>alert('Data berhasil di ubah');</script>";
- echo "<script>location='profil.php?halaman=editprofil';</script>";
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement