index.php
<form action="proseslogin.php" method="post" name="login" target="_self" id="login" style="style.css" title="login"><br />
user
:
<input type="text" name="username" id="username" />
<label>password: </label>
<input type="text" name="password" id="password" />
<label>
<input type="submit" name="Login" id="Login" value="Login" />
</label>
</form>
proseslogin.php
<?php
//function
function periksa ($username, $password){
if (($username=="user") and ($password=="123456")){
return true;
}else{
return false;
}
}
// cek
if (periksa($username, $password)) {
$login=true;
}
else {
echo "User ID atau password salah!";
}
if ($login) {
echo "<br>Di sini blok aplikasi setelah login dilakukan";
echo "<br>Anda berhasil menjalankan!";
}
?>
The following error appears:
Notice: Undefined variable: username in C:\xampp\htdocs\php_template2\proseslogin.php on line 15
Notice: Undefined variable: password in C:\xampp\htdocs\php_template2\proseslogin.php on line 15
User ID atau password salah!
Notice: Undefined variable: login in C:\xampp\htdocs\php_template2\proseslogin.php on line 21
line 15:if (periksa($username, $password)) {
line 21: if ($login) {
Why is it?
Thanks.