-2

Sorry for asking this common question again, but I couldn't find the answer. So I'm getting this error in my menu.php that im including in my index:

"Cannot modify header information - headers already sent by (output started at /home/andxeavr/public_html/bulfit.com/benching/index.php:61) in /home/andxeavr/public_html/bulfit.com/benching/includes/menu.php on line 20"

This is my index line 61:

include('includes/menu.php');

And this is my menu.php:

if (isset($_POST['search_sub'])) {

header("Location: sign_up.php");

}

So I tried with ob_start() and the other liked answers but it didn't worked.

Rohit Arora
  • 2,246
  • 2
  • 24
  • 40
  • 2
    possible duplicate of [How to fix "Headers already sent" error in PHP](http://stackoverflow.com/questions/8028957/how-to-fix-headers-already-sent-error-in-php) – m4ktub Jun 18 '15 at 07:43
  • You're probably outputing something before line 61 - without seeing the code it's impossible for anyone else to tell though. – Eborbob Jun 18 '15 at 09:27

1 Answers1

0

this question has already been answered too many times:

How to fix "Headers already sent" error in PHP

but still : You can try to avoid headers location already sent error by using on the top of file :

ob_start();

but also try to look at your code and take a look if you don't have any extra spaces in your code and you don't have any space before starting the opening tag of php from starting of file. :

<?php
  header("Location: /");
?>

And also look inside the menu.php file that you don't have any space before

   <?php

then make

<?php
Community
  • 1
  • 1
Arsh Singh
  • 1,580
  • 1
  • 11
  • 31