Page 1 of 1

writing to an HTML page from a PHP script

Posted: Tue Jul 25, 2006 12:15 pm
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

Posted: Tue Jul 25, 2006 12:43 pm
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.

Posted: Tue Jul 25, 2006 12:44 pm
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.

Problem solved.

Posted: Tue Jul 25, 2006 1:18 pm
by RobRem
Thanks for the quick replies. You have solved my dilemma.