Reputation: 647
I have a login.php (input form) and loginvalidation.php(server side validations).
I want to display an error message on login.php when input is invalid. I am not able to redirect user to login.php and display error message on it.
On Login.php the error message field is <label id="lblErrorMessage" style="color: red;"><?=$errorString?></label>
.
Upvotes: 1
Views: 633
Reputation: 6736
I presume you have a form in login.php with
<form method="post" action="loginvalidation.php">
In loginvalidation.php add
if ($badLogin) header('location:login.php?err=badLogin');
And catch the err in login.php
$err = $_GET['err'];
I'd recommend to put the validation and form in the same php-page.
<?php
if($_SERVER['REQUEST_METHOD'] == 'POST') {
//validate and if ok maby redirect (application dependent)
//if no redirect - we still need to login
$err = 'no good';
?>
<html>the login form...
regards, /t
Upvotes: 3
Reputation: 459
What I do for login forms -
Upvotes: 0