I'm wanting to store basic data from a single form box and I've created this php code base, but it doesn't seem to be working. Can someone take a glance and see if anything stands out to why this wouldn't work. Edit: the csv file never updates with new data
if (isset($_POST["submit"]))
{
$name = $_POST["name"];
date_default_timezone_set('America/New_York');
$date = date('Y-m-d H:i:s');
if (empty($name))
{
echo "ERROR MESSAGE";
die;
}
$cvsData ='"$name","$date"'.PHP_EOL;
$cvsData .= "\"$name\",\"$date\"".PHP_EOL;
$fp = fopen("emailAddressses.csv", "a");
if ($fp)
{
fwrite($fp,$cvsData); // Write information to the file
fclose($fp); // Close the file
}
}
submit&nameare set, I'd recommendfputscv, but for anything more than "it doesn't seem to be working" we need a more exact error.