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!

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.