#1
  1. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2012
    Posts
    204
    Rep Power
    3

    Headers already sent..at '<?php'


    The usual Headers problem. But i don't get the error message!

    Code:
    Warning: Cannot modify header information - headers already sent by (output started at /customers/f/4/d/notflip.be/httpd.www/ases/klant.php:5) in /customers/f/4/d/notflip.be/httpd.www/ases/klant.php on line 26
    klant.php line 5
    Code:
    <?php
    klant.php around line 26
    Code:
    	if($total > 0){
    		$_SESSION['naam'] = $naam;
    		header('location: klant_dashboard.php');
    	} else {
    		$error = 'Gebruikersnaam niet gevonden of wachtwoord incorrect';
    	}
    Does anyone see my error? thanks!
  2. #2
  3. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2012
    Posts
    29
    Rep Power
    0
    write top of the page the following code:

    PHP Code:

    <?php ob_start();  ?>
    you will see your code to get better after you write,but top of page like I said, there is no even space the above this code.
  4. #3
  5. No Profile Picture
    Lost in code
    Devshed Supreme Being (6500+ posts)

    Join Date
    Dec 2004
    Posts
    8,316
    Rep Power
    7171
    If line 5 is your opening PHP tag that means you have at least four lines of output beforehand.
    PHP FAQ

    Originally Posted by Spad
    Ah USB, the only rectangular connector where you have to make 3 attempts before you get it the right way around
  6. #4
  7. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2012
    Posts
    204
    Rep Power
    3
    Originally Posted by E-Oreo
    If line 5 is your opening PHP tag that means you have at least four lines of output beforehand.
    It's another php opening..
    PHP Code:
    <?php session_start(); 
    ?>
    <!DOCTYPE html>
    <html>
    <?php
    require 'inc/header.inc.php'
    require 
    'inc/connect.php';
    require 
    'inc/navigation.coach.inc.php';
    require 
    'inc/functions.inc.php';
    ?>
  8. #5
  9. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2012
    Posts
    29
    Rep Power
    0
    suppose,wrote in vain
  10. #6
  11. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2012
    Posts
    204
    Rep Power
    3
    Originally Posted by maximas
    suppose,wrote in vain
    What do you mean? Still haven't found the problem. thanks
  12. #7
  13. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2012
    Posts
    204
    Rep Power
    3
    This is the complete error.

    Code:
    Warning: Cannot modify header information - headers already sent by (output started at /customers/f/4/d/notflip.be/httpd.www/ases/klant.php:6) in /customers/f/4/d/notflip.be/httpd.www/ases/klant.php on line 28

  14. #8
  15. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2012
    Posts
    29
    Rep Power
    0
    PHP Code:
    <?php ob_start(); ?>
    <?php 
    session_start
    (); 
    ?>
    .
    .
    .
    .
    .
    .
    .
    I say nothing else
  16. #9
  17. --
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Jul 2012
    Posts
    3,959
    Rep Power
    1014
    Hi,

    there must not be any output before calling the header() function. But you do have output (namely the DOCTYPE and the opening html tag).

    So the design of your script is wrong. Fix it by putting all PHP logic on top and the HTML at the very end. Or even better: use a template engine like Smarty. This will let you get rid of PHP/HTML spaghetti code.

IMN logo majestic logo threadwatch logo seochat tools logo