Jump to content

[solved]Warning: Cannot Modify Header Information


signature16

Recommended Posts

I know this is probably a simple problem to solve, but I can't figure it out.  Please somebody help me!

 

 

I am getting this error:

 

Warning: Cannot modify header information - headers already sent by (output started at C:\wamp\www\usersystem3\login.php:17) in C:\wamp\www\usersystem3\login.php on line 41

 

Here is my pages code.  The include files just has the session start and the database connection. 

<?php
require_once('include.php');

?>



<!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=iso-8859-1" />
<title>Login</title>
</head>

<body>

<form action="<?php $PHP_SELF; ?>" method="post" >
Email<br />
<input name="email" type="text" /><br /><br />
Password<br />
<input name="password" type="password" /><br />
<input name="submit" type="submit" value="Log In" />
</form>


<?php
$error = '';
$form = $_POST['submit'];
$email = $_POST['email'];
$password = $_POST['password'];

if( isset($form)	) {

 if( isset($email) && isset($password) && $email !== '' && $password !== ''	)	{

	echo "everythg is filled out. yay!";
	$sql = mysql_query("SELECT * FROM `usersystem` WHERE email='$email' and password='$password';");

			if( mysql_num_rows($sql) != 0 ) { //success
				$_SESSION['logged-in'] = true;
				header('Location: redirect.php');  /// RAWR!!!! WHATS WRONG?!
				exit;
			} else { $error = "Incorrect login info"; }


 } else { $error = 'All information is not filled out correctly';}

}


echo "<br /><span style=\"color:red\">$error</span>";


?>



</body>
</html>



 

 

Thanks for the help!

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.