Warning: Cannot Modify header Information in PHP

Warning: Cannot Modify header Information Warning: Cannot modify header information in PHP Solution for PHP header cannot redirect Header to a page Welcome to the blog in this blog we discuss about the problem which occur mostly times when create a header function  in PHP. Here I will tell you the solution for this problem which works 100%. This problem occur mostly when we redirect a header to another page and the page where we using header function is also include PHP ‘include’ function. Due to ‘include’ function the header function mostly cannot redirect the header function. The solution for this error is to use JavaScript  window.location.href function instead of using PHP header function. JavaScript window.location.href function is word same as header redirecting function. Solution for this problem :- 1. Remove space / Enter space before & end of the PHP code and refresh the browser page. 2. If you are using ‘include’ function and you already done the first step and it showing header error than replace PHP header code to JavaScript code. header(location: index.php); To <script> window.location.href=”index.php”; </script> index.php is the page name where you want to redirect the header. https://youtu.be/-0a66HsgF24 If we use JavaScript function instead of PHP header function it doesn’t make any change on its working for other pager or current page. The other code work as it is work before. It work similar as the header function of PHP. This solution is use by many user.  If you don’t know how to apply JavaScript Code in PHP you may see the above video for it.  Thanking you, Amit Kumawat Developer of AK Web Edits

Warning: Cannot Modify header Information in PHP Read More »