You had a double quote here
header("'refresh=3;url=default.php');
but it will not work because you are outputting in the two lines before it here;
echo "<h1>Registeration is successful </h1>";
echo"<p class='registerationerror'><a href='register.html'>You are now redirected to the Home page</a></p>";
and you have an else statement that I took out that did... well nothing here
header('refresh=3;url=register.html');
}
else
{
And also that header will not work either because the two lines before it output to the browser here
echo "<h1 class='registerationerror'>Registeration is not successful</h1>";
echo "<p class='registerationerror'>Please Fill in all fields in the form<br/>You are now redirected to the registeration form</p>";
echo"<p class='registerationerror'><a href='register.html'>Click here to return back</a></p>";
This code should work but the redirects won't because there is output before the header(), there can not be any output before calling a header function
<html>
<head>
<title>Registeration Page</title>
<link rel="stylesheet" type="text/css" href="main.css" />
</head>
<body>
<?PHP
include 'conf.php';
include 'conn.php';
if(isset($_POST['submit']))
{
if(($_POST['authorname']=="")||($_POST['username']=="")||($_POST['password']=="")||($_POST['repassword']=="")||($_POST['email']==""))
{
echo "<h1 class='registerationerror'>Registeration is not successful</h1>";
echo "<p class='registerationerror'>Please Fill in all fields in the form<br/>You are now redirected to the registeration form</p>";
echo"<p class='registerationerror'><a href='register.html'>Click here to return back</a></p>";
header('refresh=3;url=register.html');
}
if($_POST['password']!=$_POST['repassword'])
{
echo "<h1 class='registerationerror'>Registeration is not successful</h1>";
echo "<p class='registerationerror'>Password don't match</p>";
echo"<p class='registerationerror'><a href='register.html'>Click here to return back</a></p>";
header('refresh=3;url=register.html');
}
else
{
$authorname=$_POST['authorname'];
$username=$_POST['password'];
$password=md5($_POST['password']);
$email=$_POST['email'];
$query="INSERT INTO authors (AuthorName,NumberOfArticles,username,password,AuthorEmail) values ('$authorname',0,'$username','$password','$email')";
mysql_query($query) or die("Error inserting in the database");
echo "<h1>Registeration is successful </h1>";
echo"<p class='registerationerror'><a href='register.html'>You are now redirected to the Home page</a></p>";
header('refresh=3;url=default.php');
}
}
?>