Page 1 of 1
Error Display
Posted: Fri Apr 18, 2008 2:15 am
by php14user
Hi,
There is a Login Page/form which when submitted invokes a php file "get_valid_user.php".
If the user is not valid then "get_valid_user.php" echoes the message that "Invalid/Incorrect Username or Password".
My requirement is to display this error message inside a particular cell (Row3-Col1) of the table as shown in the attached file.
How do we do this?
Thanks.
Re: Error Display
Posted: Fri Apr 18, 2008 3:10 am
by aceconcepts
Use an if statement to display and addition row and colspan
Re: Error Display
Posted: Fri Apr 18, 2008 3:57 am
by php14user
aceconcepts wrote:Use an if statement to display and addition row and colspan
But let's say the row is already there and I just need to display the error inside the first cell of 3rd Row.
Is it possible?
Thanks,
Re: Error Display
Posted: Fri Apr 18, 2008 4:03 am
by onion2k
php14user wrote:Is it possible?
Have you tried to do it?
Re: Error Display
Posted: Fri Apr 18, 2008 4:05 am
by aceconcepts
Sure, just check if there is an error and echo a message.
Re: Error Display
Posted: Fri Apr 18, 2008 5:16 am
by php14user
aceconcepts wrote:Sure, just check if there is an error and echo a message.
I am not sure what to do actually...
When I open login page, table gets created as shown in the attachment of my first mail.
The Last row is kept empty to fill the error message if invalid user tries to log in.
I would like to display the error message in the 3rd Row (colspan =4).
I am using another php file "get_valid_user.php" to validate the user and echo the message onto Login Page inside the specified cell.
Please help.
Thanks
Re: Error Display
Posted: Fri Apr 18, 2008 7:41 am
by aceconcepts
What you could do to make life simple is set the form action="".
At the top of your first page include the validation file
e.g.
Code: Select all
//PAGE 1
//check if the form has been submitted - if so then call the validation script
if(isset($_POST['submitForm']))
{
include("get_valid_user.php");
}
//display the form
<form method="post" action="">
//input fields
//if error exists then display it
if($loginErr==1)
{
echo'Invalid username and/or password';
}
//submitForm button
</form>
//Page 2 - this will be your validation script
$loginErr=0;
//if login is incorrect then $loginErr=1;
Pretty crude but hope it helps