This question has already been answered:

Warning: Cannot modify header information - it has been sent (by C: \ web \ xampp \ htdocs \ www \ includes \ overall \ header.php: 2) in C: \ web \ xampp \ htdocs \ www \ register. php on line 57

<?php if (isset($_GET['success']) && empty($_GET['success'])){ echo 'you registered'; } else { if (empty($_POST) === false && empty($errors )=== true){ $register_data = array ( 'username' => $_POST['username'], 'password' => $_POST['password'], 'first_name' => $_POST['first_name'], 'last_name' => $_POST['last_name'], 'email' => $_POST['email'] ); register_user($register_data); header('location: register.php?success'); exit(); } else if(empty($errors)===false){ echo output_errors($errors); } } ?> 

Reported as a duplicate by AK , fori1ton , Vadim Ovchinnikov , rjhdby , Cerbo participants on Jan 23 'at 8:34 .

A similar question was asked earlier and an answer has already been received. If the answers provided are not exhaustive, please ask a new question .

1 answer 1

Before the header, there should be no echo, print, etc.

  • youtube.com/watch?feature=endscreen&NR=1&v=5A50qmC7wFo and here it is and nothing works fine - LLIAKAJI
  • Perhaps you have a high level of php errors on your server. Therefore, this error appears. You can use JavaScript redirection: <script> document.location.href = 'index.php'; </ script>. Instead of index.php, you need to put the address of the page to which the user should be redirected. The user will still not notice what the redirection is built on. - atnartur