html code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Login Page</title> <link rel="stylesheet" type="text/css" href="style/view_login.css" media="all"> </head> <body id="main_body" > <img src="images/top.png" alt="" width="502" height="9" id="top"> <div id="form_container"> <h1><a></a></h1> <p align="center"><u>Log in</u> <p align="center">Please insert username and password: <form id="login" class="appnitro" method="post" action="<?php echo $_SERVER['PHP_SELF'];?>"> <div class="form_description"> <div align="center">Username: <input type="text" name="username" size="10" /> <br /> <br /> Password: <input type="password" name="pass" size="10" /> <br /> <br /> <input type="submit" value="Connect" /> </div> </form> <p align="right"><input type="button" onClick="location.href='http://localhost/my_ptyxiakh/register.html'" value="ΕγÏαφή" /> </div> </body> </html> php code: <?php session_start(); // Has a session been initiated previously? if (! isset($_SESSION['name'])) { // If no previous session, has the user submitted the form? if (isset($_POST['username'])) { $username = $_POST['username']; $pass = $_POST['pass']; // Connect to the PostgreSQL database $conn=pg_connect("host=localhost dbname=postgres user=postgres password=xxxxxxx") or die(pg_last_error($conn)); // Look for the user in the users table. $query = "SELECT username FROM login WHERE username='$username' AND pass='$pass'"; $result = pg_query($conn, $query); // If the user was found, assign some session variables. if (pg_num_rows($result) == 1) { $_SESSION['name'] = pg_fetch_result($result,0,'name'); echo"<META HTTP-EQUIV=\"REFRESH\" CONTENT= \"1;URL=http:.......\">"; //$_SESSION['username'] = pg_fetch_result($result,0,'username'); //echo "You're logged in"; // If the user has not previously logged in } } else { include "http://localhost/my_ptyxiakh/login.html"; } // The user has returned. } else { $name = $_SESSION['name']; echo "Welcome back, $name!"; echo"<META HTTP-EQUIV=\"REFRESH\" CONTENT= \"1;URL=http:.......\">"; } ?> I am trying to make a login page..but.. Could you please tell me why this is not working..?? this code it is not the whole mine so could you please tell me what is happening???