why my application is running only when ob_start() method is used
<p>I have written a simple application which has login page. After login search insertion buttons are there. I build this simple application and run successfully last month. But now when i am using this now my pages are not redirecting to next page. i double checked my syntax.</p>

<p>i googled for the answer and found ob_start() method. And now my application is running successfully.</p>

<p>when the first time i have used this application i didn't use ob_start. But why its not working now without the ob_start(); method.</p>

<p>Please explain.</p>

<p>Search funtion :</p>

<pre><code>            $email = $_POST['search'];
    $sql = "select * from employee_details where ";
    if($email){
    $sql .= " email = '$email' ";
    }

    $rv = mysql_query($sql);
    if(mysql_num_rows($rv) == 0){
    $errmsg_arr[] = "Employee records are not found.";
    $page = "HomePage.php";
    $errflag = true;    
    errors($page,$errmsg_arr, $errflag );
    }
    while( $row = mysql_fetch_array($rv)){
     $var['employee_id'] = $row['employee_id'];
     $var['employeename'] = $row['employee_name'];
     $var['email'] = $row['email'];
     $var['phone'] = $row['phone'];
     $var['address1'] = $row['address1'];
     $var['state'] = $row['state'];
     $var['country'] = $row['country'];
    }
    addvars($var);
    header("location: EmployeeDetails.php");    
</code></pre>

<p>addvars function:</p>

<pre><code>function addvars($vars) {
    session_start();
$_SESSION[] = array();  

    foreach($vars as $keys =&gt; $vals) {  

$_SESSION[$keys] = $vals;   

}
 }
</code></pre>

<p>Errors Function:</p>

<pre><code>function errors($page,$errmsg_arr, $errflag){
if($errflag) {
    session_start();
    $_SESSION['ERRMSG_ARR'] = $errmsg_arr;
    session_write_close();
    header("location: $page");
    exit();
}
}
</code></pre>
