Page Redirection problem in php -


i want redirect login page main page using php. use following line of code: header('location:index.php'); inspite of redirection received error like:

warning: cannot modify header information - headers sent (output started @ c:\wamp\www\student\login.php:18) in c:\wamp\www\student\login.php on line 19 

this error occures if print before header() function.

for example:

<?php echo 'test'; header('location:index.php'); exit; ?> 

or even:

<html>   <head> ..... <?php echo 'test'; header('location:index.php'); exit; ?> 

you have move piece of php code before operation gives output.

you can following trick second way should try:

<?php echo 'test'; ob_start(); flush(); header('location:index.php'); exit; ?> 

Comments

Popular posts from this blog

Cursor error with postgresql, pgpool and php -

delphi - ESC/P programming! -

c++ - error: use of deleted function -