PDA

View Full Version : Irritating Problem



Sam
29-03-2007, 02:58 PM
Im having this really irritating problem where , im trying to redirect to a page but im getting the error

'Warning: Cannot modify header information - headers already sent by (output started at /home/blah/blah/blah/) in /home/blah/blah/blah/ on line 23
'

I have login.php which contains all the PHP (When the user logs in it creates a session and tries to redirect to interface.php which contains functions.) and login_main.php which has the HTML and some other bits and bobs. The form in the html uses
<form action="login.php" method="post">

I cant seem to find a way around it. Whenever i try to use header( 'ocation: page.php'); i get that error.

Its probably a silly mistake but. Advice?

Tomm
29-03-2007, 03:26 PM
You can't output any HTML (Or anything really) to the browser before you send headers.

Invent
29-03-2007, 04:03 PM
Just put the login info (from the login_main.php) into the login.php file at the bottom and send the form through a GET parameter or whatever (EG: login.php?login=true). Then at the very top of the document so then there is no outputted data before the headers, have the login php code.

Moh
29-03-2007, 04:08 PM
This is what I realy hate about PHP & HTML

Invent
29-03-2007, 04:12 PM
What's so hard about doing that?

Sam
29-03-2007, 06:38 PM
Hmm well i pretty much rewrote it. According to the error. Its because of the connect.php .. But i cant see why it would be.

Want to hide these adverts? Register an account for free!