i need help in the below code i take one check box when someone check it then its will be redirect to given page if false then its will give message please check the box but when its true i want to redirect to given page but its giving error. <? if ($_GET['action'] == Submit) { if($_POST['Agree'] == Yes) { header("Location: index.php"); } else { echo "Agree Please"; } } ?> error Warning: Cannot modify header information - headers already sent by (output started at D:\Apache\htdocs\site\site\agreement.php:7) in D:\Apache\htdocs\site\site\agreement.php:7 on line number.
It says that the output has started in D:\Apache\htdocs\site\site\agreement.php on line 7, so it can't send headers, try to delete any space before <?php and after ?>, or better yet, delete PHP closing tag, ?>. One alternative is that you turn on output buffering.