I want to redirect from login page to my main page using php.
I use the following line of code: header('location:index.php');
inspite of redirection i received the error like:
Warning: Cannot modify header information -
headers already sent by (output started at C:\wamp\www\student\login.php:18)
in C:\wamp\www\student\login.php on line 19
This error occures if you print something before
header()function.For example:
or even:
You have to move this piece of PHP code before any operation that gives you an output.
You can also do the following trick but it is the second way you should try: