title: PHP header redirect not working when posting a form - using output buffer - but does in other cases?
body: <p>I have an unusual problem, only happening on one server.
  Following code</p>
  
  <pre><code>....
  elseif ($_GET['action']=='login') {
  
   if (empty($_POST['login_name'])) { $_POST['login_name']=''; }
   if (empty($_POST['login_pass'])) { $_POST['login_pass']=''; }
   if (!empty($_POST['send'])) {
    if (($_POST['login_name']==_ADMIN_NAME) and    ($_POST['login_pass']==_ADMIN_PASS)) {
     //Successfully logged in
     $_SESSION['logged']=1;
  
  // DOES NOT WORK
     header('Location: '.$filename);
     die('Command '.$filename);
    }
   }
  // Show Form;
  include('plogin.inc.php');
  } 
  elseif ($_GET['action']=='logout') {
   $_SESSION['logged']=-1;
  // DOES WORK!
   header('Location: '.$filename);
  }
  </code></pre>
  
  <p>So the problem is this if i click the link logout, all goes well and i get redirected to $filename.
  If i submit the login form it checks if the post is correct, set's the session var, but then dies instead of redirecting.</p>
  
  <p>I got output buffers on, all error reporting but (no errors), it doesn't redirect when I post with the form even though it definitely passes (because the session var is set and I get to the die part)</p>
  
  <p>What could be the cause for this behavior?
  Thanks</p>