when a user enters invalid username or password i redirect him to the login page again..but how can i display a message invalid usernmae in the login page..kindly help..

Very simple. While redirecting, redirect with a value in the query string. And if that variable is set, display the error message.
eg.

<?php
//incorrect login
header("location: login.php?err=1");
?>

And in login.php,

<?php
if(isset($_GET['err'])){
$errormsg="Incorrect login..";
}
//display $errormsg whereever you want, to indicate an invalid login. 
// rest of the code
?>

Cheers,
Naveen

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.