i have a file 'header.php' which has a search text box in it. Another file called 'myPage.php' includes 'header.php'. In header.php
if (isset($_POST['Searchbutton'])){ // this will execute when the search button is clicked.
$target = $_POST['searchtext'];
header("Location: searchresult.php?text=" . $target); // line #8
}
In myPage.php
<?php
include("header.php");
?>
When i'm on "myPage.php" and use the search option, i get an error that says
Cannot modify header information - headers already sent by (output started at myPage.php:3) in header.php on line 8.
Can anyone please help me understand the concept. I'm a newbie to php. Please ask if any more info is required.
Cheers!