File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Redirecting to a login page with error messages

 
Mahtab Alam
Ranch Hand
Posts: 391
1
Java MySQL Database PHP
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a login page having two fields username and password.

In the Login.html I have

<form method="post" action="checkLogin.php">
Username : <input type="text" name="username">
Password : <input type="password" name="password">
<input type="submit" value="Login">
</form>

In the checkLogin.php
I want to redirect to user to Login.html if username field or password field left blank.


How can I do that? How can I display error message also with redirection to Login.html.
 
Supun Lakshan Dissanayake
Ranch Hand
Posts: 135
Android Java PHP
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
try with this

<?php
if(!isset($_POST['username']) || !isset($_POST['password']) || empty($_POST['username']) || empty($_POST['password'])){
header("Location:Login.html");
}
?>
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic