Hello! I used the following couple of lines to redirect to a page: header("Location:index.php?ad_detail=1&ad_id=".$adId); exit(); It shows: Cannot modify header information - headers already sent Then, I used the following couple of lines to redirect to a page: header("location:index.php?contact_us=1"); exit(); It also shows: Cannot modify header information - headers already sent Finally, I used the following couple of lines to redirect to a page: header("location:index.php"); exit(); It also shows: Cannot modify header information - headers already sent Is there any solution? Please help me out ASAP
You must have no 'echo' output before header, no spaces before php tags, no html code before header sent.
<?php ob_start(); //put the rest of your code here ob_end_flush(); ?> PHP: will insure that no header is sent until all your code is processed.