Jump to content

Recommended Posts

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  :)

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.

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.