Form Login Error

Posted by ilp on Stack Overflow See other posts from Stack Overflow or by ilp
Published on 2012-09-19T03:36:28Z Indexed on 2012/09/19 3:37 UTC
Read the original article Hit count: 93

Filed under:
|
|
|

I'm having issues with a login form for my website. At the top of the login.php form I have this

<?php 
if (isset($_SESSION['username'])){
header("Location: http://myurl/"); die;}?>
<?php require 'includes/dbconnect.php' ; 
?> 
<?php require 'includes/header.php';  ?>

and when login is successful I redirect them to

header('Location: http://myrul/');

Header.php has

<?php session_start(); ?>

at the top.

When I tried to login, I get this error message:

Warning: Cannot modify header information - headers already sent by (output started at /path/to/file/login.php:7) in /path/to/file/login.php on line 39.

login.php:7 ==> <?php require 'includes/header.php'; ?>

while

Line 39 in login.php is ==> header('Location: http://myrul/');

Please where is the problem

© Stack Overflow or respective owner

Related posts about php

Related posts about session