PHPiSean Posted February 14, 2011 Share Posted February 14, 2011 I get an error stating that I cannot modify header information when I try to add a title to my login page. Here's <?php session_start(); require_once("includes/dbconn.php"); include("includes/htmlheader.php"); mysql_select_db(center); $user = $_POST['username']; $pass = $_POST['password']; $sql = "select username, password from users"; $result = mysql_query($sql); $row = mysql_fetch_array($result); $isuser = $row['username']; $ispass = $row['password']; if(isset($_POST['submit'])){ if(($user==$isuser)&&($pass==$ispass)) { $_SESSION['username'] = $user; header("Location: home.php"); }else{ echo "Invalid Username or Password"; } } ?> The htmlheader.php has the title string. Help is appreciated Quote Link to comment https://forums.phpfreaks.com/topic/227663-warning-cannot-modify-header-information/ Share on other sites More sharing options...
KevinM1 Posted February 14, 2011 Share Posted February 14, 2011 Our first thread in this subforum deals with exactly this: http://www.phpfreaks.com/forums/php-coding-help/header-errors-read-here-before-posting-them/ Quote Link to comment https://forums.phpfreaks.com/topic/227663-warning-cannot-modify-header-information/#findComment-1174241 Share on other sites More sharing options...
PFMaBiSmAd Posted February 14, 2011 Share Posted February 14, 2011 The error message, that you didn't post, tells you where the output is occurring at that is preventing the header() from working. I'll guess it was a line in the htmlheader.php file? You cannot output any characters to the browser before you use a header() statement and if you are going to redirect the browser, there's no point in outputting anything, even if it did work. Quote Link to comment https://forums.phpfreaks.com/topic/227663-warning-cannot-modify-header-information/#findComment-1174242 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.