mehmetiscod adlı üyeden alıntı: mesajı görüntüle
Merhaba, data tarafına input olarak checkbox gönderebilirsiniz. post işlemini jquery + ajax ile yapmanız gerekir. Alert göstermek için sweet alert kullanabilirsiniz.
ben normal tarayıcı alerti kullanacağım.
// html kodu
<form action="post.php" id="submit" method="post">
<input type="text" name="username" placeholder="kullanıcı adı">
<input type="password" name="password" placeholder="şifreniz">
<input type="checkbox" name="is_view">Mesajı göster<br>
</form>
// post.php kodları
$username = $_POST['username'];
$password = $_POST['password'];
$check = $_POST['is_view'];
###############LOGİN KODLARINIZ VS ###################
// giriş başarılıysa şu veri döndürülecek
$array = [
'is_view' => $check,
'message' => 'Gösterilecek mesaj içeriği',
'redirect' => 'site.com/yonlenecek-sayfa'
];
echo json_encode($array);
//Jquery kodları (index.js)
$(function(){
$("form#submit").on('submit',function(e){
e.preventDefault();
$.ajax({
type : 'POST',
url : $(this).attr("action"),
data : $(this).serializeArray(),
dataType : 'json',
success : function(xhr){
if(xhr.is_view == 'on'){
alert('Mesajınız' + xhr.info);
}
window.location.href = xhr.redirect;
}
});
});
});
hocam çok güzel yazıssınız fakat benım kodlara nasıl eklerım bunu