title: php write csv file with carriage return line feeds
body: <p>I am trying to use php to write an array written in Javascript to a csv file with carriage return and line feeds separating the rows. The code below writes the csv file, but all on one line. Can anyone tell me how to alter it to include carriage return /line feed separatos between each line? Thanks </p>
  
  <pre><code>&lt;?php
  if(isset($_POST["Row"])){
      $rlist = $_POST["Row"];
      //$col = $_POST["Col"];
      $fname =($_POST["Fname"]);
      $fname = $fname . ".csv";
      $rArray = explode("-",$rlist);
      $totalR = count($rArray);
      $fp = fopen($fname, 'w');
      for($i =0; $i&lt;$totalR;$i++){
          $row = $rArray[$i];
          $srow =explode(",",$row); 
          array_push($srow,"\n");
          fputcsv($fp,$srow);
      }
  fclose($fp);
  }
  ?&gt;
  </code></pre>