<?php include("C:/xampp/htdocs/mySalon/connect_database.php");?>

if(isset ($_POST ['username']) && $_POST ['password']){
$username = $_POST['username'];

$query=mysql_query("SELECT * FROM admin WHERE username='$username'");

if ($numrows!=0)

	while ($row=mysql_fetch_assoc($query))
	//check to see if they match!
	if ($username==$dbusername&& md5 ($password)==$dbpassword)
		header ('Location: http://localhost/mySalon/admin/admin_page.php');
		$_SESSION['username'] = $username;
		echo "Incorrect Password";
 echo "You are not the administrator";
  echo "";

Member Avatar

ensure that there is NO output in the file prior to header(). That is, no error echo, no html, no whitespace, nothing.

If you check and there is definitely no output, you may have an issue witht he file format. You should save your files as UTF-8 WITHOUT BOM (e.g. in more advanced text editors like Notepad++). Often text editor will default to ANSI or other. BOMs cause 'invisible' output which mess up header().

get rid of the blank lines, they are output

Remove the outputs from your header.

In this instance simply delete the white spacing on lines 1 and two so delete everything before <?php on line 1 and 2.