I am trying to generate a CSV file containing the name and email address from an form in an HTML file and using the PHP fputcsv function. But I am unable to pass the value of variables to the array and it is returning error message.
My PHP file:
<?php
$name = $_GET["name"];
$email = $_GET["email"];
$list = array
(
'$name', '$email',
);
$file = fopen("list.csv","w");
foreach ($list as $line)
{
fputcsv($file,split(',',$line));
}
fclose($file);
?>
The error message:
Deprecated: Function split() is deprecated in F:\xampp\htdocs\test.php on line 22
Deprecated: Function split() is deprecated in F:\xampp\htdocs\test.php on line 22
My line 22 contains:
fputcsv($file,split(',',$line));
I don't get the above error if I just use plain text in array. What am I doing wrong?