Jquery Login Form In Div Without Refreshing Whole Page
I have a php-file that i want to put to work in a div:
Solution 2:
Change your code to process the form submission before it prints out the form. It might seem counter intuitive, but unless you process all input first, the HTML you have printed is already obsolete when it is ready to be sent to the browser.
You also won't need the refresh header if you use ajax.
Just change your code like this:
functionloginLogout() {
if(isset($_POST['login']) && isset($_POST['user']) && isset($_POST['passwd']) &&
$_POST['user'] == "admin" && $_POST['passwd'] == "admin") {
$_SESSION['user'] = $_POST['user'];
$_SESSION['passwd'] = $_POST['passwd'];
}
if(isset($_POST['logout']) && isset($_SESSION)) {
foreach($_SESSIONas$k => $v) {
unset($_SESSION[$k]);
}
}
$loggedUser = loggedUser();
if(!empty($loggedUser)) {
logoutForm();
} else {
loginForm();
}
}
Post a Comment for "Jquery Login Form In Div Without Refreshing Whole Page"