writing to an HTML page from a PHP script

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
RobRem
Forum Newbie
Posts: 4
Joined: Tue Jul 25, 2006 11:54 am

writing to an HTML page from a PHP script

Post by RobRem »

I have an html page called login.html. It has a username , password field, and Submit button.
I have a script that checks a database for a username/password match, Validate.php.
If there is no match found, I return the user back to the Login page with the line
header("Location:Login.html");
My question is, rather than just putting them back on login.html, , I'd like to write a message on the login.html page stating something like "login unsuccessful, please try again."
Is there a function I can use to do this, or is it even possible?

Thanks,
Robert
User avatar
nickman013
Forum Regular
Posts: 764
Joined: Sun Aug 14, 2005 12:02 am
Location: Long Island, New York

Post by nickman013 »

Its very much possible. The easy way to do it is to just create another login.php with "Invalid Login" above the form, and if it is wrong have them redirected to the login page that says it is wrong.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

login.html would need the PHP code in it, or the page would need ajax data handling to get the success/failure signal.
RobRem
Forum Newbie
Posts: 4
Joined: Tue Jul 25, 2006 11:54 am

Problem solved.

Post by RobRem »

Thanks for the quick replies. You have solved my dilemma.
Post Reply