How can I Create a login Form with Sweet Alert and , fetch Values from the Form toMySQL.
is this Possible?
If yes , then Can anyone explain the working with proper code?
is this code works?
Swal.fire({
title: 'Login Form',
html: `<input type="text" id="login" class="swal2-input"
placeholder="Username">
<input type="password" id="password" class="swal2-input"
placeholder="Password">`,
confirmButtonText: 'Sign in',
focusConfirm: false,
preConfirm: () => {
const login = Swal.getPopup().querySelector('#login').value
const password =
Swal.getPopup().querySelector('#password').value
if (!login || !password) {
Swal.showValidationMessage(`Please enter login and
password`)
}
return { login: login, password: password }
}
}).then((result) => {
Swal.fire(`
Login: ${result.value.login}
Password: ${result.value.password}
`.trim())
})