I have created a small web site with a registration page.I want to get after the user fill the registration form and click the submit button , the page must be redirected to the login page.That redirection part is not working.Here is my database connection code to add data to my database and header function to redirect to login page. But when I test this in localhost, white blank page is shown as redirected page.Is there any error in this code.Data is successfully added to the database.That part is OK.If I put an echo statement right after the header() , that will be shown but not redirect to Login_page.I typed the header() as this also(header("Location:http//Login_page.html")).But the same problem arise.Please help me.Thanks.

<!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">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>


  $con = mysql_connect("localhost","","");
if (!$con)
  die('Could not connect: ' . mysql_error());
mysql_select_db("Real Truth", $con);

$sql="INSERT INTO register

if (!mysql_query($sql,$con))
  die('Error: ' . mysql_error());

5 Years
Discussion Span
Last Post by diafol

If you get a white page then the chances are it is getting stuck midway through the code, add this to the top of your PHP and see if it reads anything out:


Equally, why do you have a double set of asterix's around your redirect?


It looks like your problem is here:


remove the astrix's .. Also, don't use mysql_* functions. Your query is also unsafe.


die() will prevent header() if it's called. Ideally header() should have an exit; after it.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.