I am trying to write post variables to a csv file but it writes everything in one line separated by comma
<?php
$list= array($_POST['purchases']);
$file = fopen("purchases.csv", "w");
foreach ($list as $line)
{
fputcsv($file, $line);
}
fclose($file);
?>
Result in purchases.csv file
Marilyn,Nancy,Johan,Carol,Juanic,Shirley
But I want every string value on separated line
Marilyn
Nancy
Johan
Carol
Juanic
Shirley