title: How to fix Header new line error
body: <p>I am receiving the following error message "Header may not contain more than a single header, new line detected" I know it says that a new line has been detected, but I cannot figure where this line is coming from. I have tried to trim the variables..I have re-written the header line in different ways, without any result. I added the getallheaders function to see what was being passed, but I see no new line or any extra characters in the output $headers. Even using ob_start() does not help.</p>
  
  <pre><code>&lt;?php
  ob_start();
  include "catalog.obj";
  
  session_start(); 
  $catalogObj = $_SESSION['catalogObj'];
  
  if (isset($_POST['st']))
  $st = $_POST['st'];
  else
  $st = '0';
  if (isset($_POST['num']))
  $num = $_POST['num'];
  else
  $num = '0';
  if (isset($_POST['type']))
  $type = $_POST['type'];
  else
  $type = '0';
  if (isset($_POST['rec']))
  $rec = $_POST['rec'];
  else
  $rec = '0';
  if (isset($_POST['option']))
  $option = $_POST['option'];
  else
  $option = '0';
  
  if(strcmp($_POST['submit'],"Reset Form") == 0)
  {
      header("location: search_catalog.php?type=$type&amp;firstTime=1"); 
      exit; 
  }
  elseif(strcmp($_POST['submit'],"Catalog Administration") == 0)
  {
      Header("Location: administration.php");
      exit;
  }
  else
  {
      $inventory_id_num = $_POST['inventory_id_num'];
      $inventory_desc = $_POST['inventory_desc'];
      $inventory_revision = $_POST['inventory_revision'];
      $quantity = $_POST['quantity'];
      $catalog_status_id = $_POST['catalog_status_id'];
      $order_form_type_id = $_POST['order_form_type_id'];
  
      $catalogObj-&gt;inventory_id_num = $inventory_id_num;
      $catalogObj-&gt;inventory_desc = $inventory_desc;
      $catalogObj-&gt;inventory_revision = $inventory_revision;
      $catalogObj-&gt;quantity = $quantity;
      $catalogObj-&gt;catalog_status_id = $catalog_status_id;
      //$catalogObj-&gt;order_form_type_id = array();
      $catalogObj-&gt;order_form_type_id = $order_form_type_id;
  
      $count=count($order_form_type_id);
      for ($i=0; $i&lt;$count; $i++) 
      {
          //print "order_form_type_id: $order_form_type_id[$i]&lt;br&gt;";
          if(strlen($order_form_type_id[$i]) &gt; 0)
          {
              $catalogObj-&gt;order_form_type_id[$i] = $order_form_type_id[$i];
          }
      }
  
      if(strcmp($_POST['submit'],"Back to Order Form") == 0)
      {
          Header("Location: order_form.php?num=$num");
          exit;
      } 
      else
      {
          //$url = "type=".$type."option=".$option."rec=".$rec."st=".$st."num=".$num;
          Header("location: search_catalog_handler.php?type=$type&amp;option=$option&amp;rec=$rec&amp;st=$st&amp;num=$num"); 
          //Header("location: search_catalog_handler.php?" . rawurlencode($url));
          if (function_exists('getallheaders'))
          {
              $headers = getallheaders();
              print_r( $headers);
          }       
          exit;
      }
  
  }
      function getallheaders()
      {
             $headers = '';
         foreach ($_SERVER as $name =&gt; $value)
         {
             if (substr($name, 0, 5) == 'HTTP_')
             {
                 $headers[str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', substr($name, 5)))))] = $value;
             }
         }
         return $headers;
      }
  
  ?&gt;
  </code></pre>