- Name
Email
Phone Number
Message
Newsletter
It emails perfectly fine, but no CSV anywhere is created or names added to the one that I created. Here is my php Code:
Code: Select all
<?php
if (isset($newsletter)) {
header("Content-type: application/x-msdownload");
header("Content-Disposition: attachment; filename=newsletter.csv");
header("Pragma: no-cache");
header("Expires: 0");
}
//Contact form field variable settings.
$name = $_POST['name'];
$email = $_POST['email'];
$phone = $_POST['phone'];
$msg = $_POST['message'];
$newsletter = $_POST['newsletter'];
$row = 'Email,';
$row .= $email;
$data = $row."\n";
//Configurations for email
$to = "gkwinspired@gmail.com";
$subject = "Form Response at Karen Whitworth.net";
$body = "From: $name <$email>\n\n";
$body .= "$msg";
//newsletter settings
mail($to, $subject, $body, "From: $email");
header ("Location: http://www.karenwhitworth.net/thankyou.htm");
?>I understand that the "newsletter" variable isn't created since it isn't sent, but I don't know how to combat that, maybe (!isset...Undefined index: newsletter in D:\users\karenwhitworth.net\templates\scripts\phpForm.php on line 15
Not sure - please help!!
Thanks,
Greg