Jump to content


Photo

Warning: Cannot modify header


  • Please log in to reply
6 replies to this topic

#1 alexcrosson

alexcrosson
  • Members
  • PipPip
  • Member
  • 21 posts

Posted 03 October 2006 - 01:08 PM

This is the error I get:
Warning: Cannot modify header information - headers already sent by (output started at /home/totallyc/public_html/login/users.php:18) in /home/totallyc/public_html/login/add_user.php on line 16
Here is my code starting at line 16:
header("Location: users.php");
I need to redirect after a user has been added and i'm having trouble doing it.

#2 ToonMariner

ToonMariner
  • Members
  • PipPipPip
  • Advanced Member
  • 3,342 posts
  • LocationNewcastle upon Tyne, UK

Posted 03 October 2006 - 01:09 PM

you have output some html or whitespace before that line of code gets executed....

headers must be sent before you do that.
follow me on twitter @PHPsycho

#3 thedarkwinter

thedarkwinter
  • Members
  • PipPipPip
  • Advanced Member
  • 191 posts
  • LocationLondon

Posted 03 October 2006 - 01:10 PM

are you outputting anything on purpose?

sometimes if there is an empty line after the ?> and the end of the file is creates this problem

does that help?

cheers,
tdw
Remember - if you don't figure it out yourself, you'll probably forget it tomorrow :)

#4 alexcrosson

alexcrosson
  • Members
  • PipPip
  • Member
  • 21 posts

Posted 03 October 2006 - 01:14 PM

Well there isn't any empty lines that i can see after the ?>

#5 thedarkwinter

thedarkwinter
  • Members
  • PipPipPip
  • Advanced Member
  • 191 posts
  • LocationLondon

Posted 03 October 2006 - 01:20 PM

... or before the <?php

if you post the source i can look for the output...

tdw
Remember - if you don't figure it out yourself, you'll probably forget it tomorrow :)

#6 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 03 October 2006 - 02:32 PM

You have output being made around line 18 in users.php

Post lines 13 to 23 here from users.php

#7 saiko

saiko
  • Members
  • PipPipPip
  • Advanced Member
  • 37 posts

Posted 04 October 2006 - 09:34 AM

add

<?
ob_start();


then at the end

ob_end_flush();
?>




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users