I have a login form in html, php, css languages. I want to browser to ask me automaticly to save the username and password. But it is not working. I am singin in the portal but i can not save the username and password.
My codes like that:
<?php
if ($_POST and !empty($_POST['username']) and !empty($_POST['password'])) {
$sifre = $_POST['password'];
$AD = $_POST['username'];
$kontrol = $db2->query("SELECT * FROM Firma WHERE Kod = '$AD' and Parola = '$sifre' ")->fetch(PDO::FETCH_ASSOC);
if ($kontrol) {
$_SESSION['admin']['login'] = 1;
$_SESSION['admin']['id'] = $kontrol['ID'];
$_SESSION['admin']['Firma_Adi'] = $kontrol['Firma_Adi'];
$_SESSION['admin']['Tur'] = $kontrol['Tur'];
$_SESSION['admin']['kod'] = $kontrol['Kod'];
$_SESSION['admin']['yetkili'] = $kontrol['Yetkili'];
$_SESSION['admin']['plasiyer'] = $kontrol['PlasiyerID'];
/* ?><script>Swal.fire( 'Giriş İşlemi Başarılı', 'Başarıyla giriş yaptınız, 1 saniye içerisinde yönlendiriliyorsunuz.', 'success' );</script><?php */
header('refresh: 0; url=' . $site . 'ozet');
} else {
?>
<script>Swal.fire('Hata', 'Kullanıcı adı veya şifrenizi kontrol ediniz.', 'error');</script><?php
}
}
?>
<form action="" method="post" autocomplete="on" >
<div class="form-group">
<input type="text" id="username" name="username" autocomplete="username" class="form-control"
placeholder="Kullanıcı Adı" required>
</div>
<div class="form-group">
<input type="password" id="password" name="password" autocomplete="current-password" class="form-control"
placeholder="Şifre" required>
</div>
<div class="form-group">
<button type="submit" class="btn btn-main-primary btn-block">Giriş
Yap</button>
</div>
</form>
I tried autocomplete but it is not working. And I add form action”index.php” it is also not working. When i add action the page is not works correctly.