title: saving data in csv file using php
body: <p>I am taking data from a form and saving it in a CSV file using PHP. My one field in the form contain the comma in it, i.e., between two words a comma is there and I need to store that in the CSV file with a comma. But when I an saving it the values left and right to comma are stored in different rows. How can I do it?
  My code is:</p>
  
  <pre><code>enter code here
  &lt;?php
  //read data from form
  $food = filter_input(INPUT_POST, "food"); 
  $output = $food . "\n";
  $fp="input.csv";
  if (file_exists($fp)) {
  file_put_contents($fp, $output, FILE_APPEND);
  }
  else {
  file_put_contents($fp, $output);
  }
  ?&gt;
  </code></pre>