I tried a code on my LocalHost server and it worked perfectly , but when i uploaded the page on web server this redirection function not working :
header('location:ControlPanel/Add_course.php');
Any hint how to fix it ?
I tried a code on my LocalHost server and it worked perfectly , but when i uploaded the page on web server this redirection function not working :
header('location:ControlPanel/Add_course.php');
Any hint how to fix it ?
remove all the print
statements and echo
statements in that page I mean if you are redirecting in main page remove unwanted print
and echo
as well as ?>
.
I also had this issue
header() must be called before any actual output is sent, either by normal HTML tags, blank lines in a file, or from PHP
Combine all your PHP codes and make sure you don't have any spaces at the beginning of the file.
It should be Location not location
.
also after header('Location:ControlPanel/Add_course.php');
add exit();
if you have any other scripts below.
If still problem exist, use ob_start() and try below code:-
ob_start();
header('Location:ControlPanel/Add_course.php');
exit();
If none of them working then only use Js syntax to redirect by below way:-
echo "<script type='text/javascript'> document.location = 'ControlPanel/Add_course.php'; </script>";
Hope it will help you :)