Postingan lainnya
Undefined variable php
Saya ingin membuat edit akun, saat menampilkan username & level pada form tidak maslah(muncul) tetapi saat menampilkan password error <br /><b>Notice</b>: Undefined variable: password in <b>C:\xampp\htdocs\sdi2\user.php</b> on line <b>84</b><br /> berikut ini scriptnya
session_start();
$username = $_SESSION['username'];
$password = $_SESSION['password'];
$level = $_SESSION['level'];
if (isset($_GET['id'])) {
$id = $_GET['id'];
$edit = mysqli_query($koneksi,"SELECT * FROM user WHERE id ='$id' ");
while($fiuh = mysqli_fetch_assoc($edit)){
$username = $fiuh['username'];
$password = $fiuh['password'];
$level = $fiuh['level'];
}
}
dan formnya
<form action="user.php" method="POST">
<div class="form-group">
<label for="username">Username :</label>
<input type="text" name="username" class="form-control" value="<?php echo $username; ?>">
</div>
<div class="form-group">
<label for="password">Password :</label>
<input type="text" name="password" class="form-control" value="<?php echo $password; ?>">
</div>
<div class="form-group">
<label for="level">Level :</label>
<input type="text" name="level" class="form-control" value="<?php echo $level; ?>">
</div>
<input type="submit" name="edit" class="btn btn-primary" value="EDIT">
</form>
Kira-kira bagian mana yang salah ya?
0
Tanggapan
kyaknya password mah ga perlu ditampilin deh hehe
1 Jawaban:
arti erronya variable "$password" tidak terbaca, cari variable $password dari mana
0