Jump to content

Recommended Posts

Hello All

I want to change my script so that it outputs a comma separated text. Immediately below is what I started with, and below that is what I changed it to in order to get it to put CSV text in the email body.

I get an error stating that: Parse error: parse error, unexpected '\"' in in retention.php on line 81

Any ideas on what change I need to do to fix this?

Thanks in advance for your help



THIS IS A PORTION OF THE ORIGINAL SCRIPT
//Sending Email to form owner
$pfw_header = "From: me@myemail.com\n"
  . "Reply-To: me@myemail.com\n";
$pfw_subject = "Retention Summary";
$pfw_email_to = "you@youremail.com";
$pfw_message = "Visitor's IP: $pfw_ip\n"
. "sflteam: $sflteam\n"
. "teamemail: $teamemail\n"
. "Last_Name_drop: $Last_Name_drop\n"
. "First_Name_drop: $First_Name_drop\n"
. "pos_drop: $pos_drop\n"
. "team_drop: $team_drop\n"
. "Last_Name_retain: $Last_Name_retain\n"
. "First_Name_retain: $First_Name_retain\n"
. "pos_retain: $pos_retain\n"
. "team_retain: $team_retain\n";
@mail($pfw_email_to, $pfw_subject ,$pfw_message ,$pfw_header ) ;


THIS IS THE PORTION OF THE SCRIPT AFTER I EDITED IT

//Sending Email to form owner
$pfw_header = "From: me@myemail.com\n"
  . "Reply-To: me@myemail.com\n";
$pfw_subject = "Retention Summary";
$pfw_email_to = "you@youremail.com";
$pfw_message = "Visitor's IP: $pfw_ip\n"
"$sflteam", "$Last_Name_drop", "$First_Name_drop", "$pos_drop", "$team_drop", "$Last_Name_retain", "$First_Name_retain", "$pos_retain", "$team_retain";
@mail($pfw_email_to, $pfw_subject ,$pfw_message ,$pfw_header ) ;



Link to comment
https://forums.phpfreaks.com/topic/19931-want-to-change-output-to-csv/
Share on other sites

well, if you can get all the records into an array, simply use implode() with commas as the delimiters to make a row. to make a CSV file, typically you'll need to change your content-type to text/plain or something similar and output newlines at the end of each row.

i'm not sure exactly what you're after here... any more explanation?
Thanks all for the help.

This is the kind of output (in the body of an email) that I was after:

Visitor's IP: 65.243.45.100
DKN, Brown, J, Driver, OH, Green, A, Loader, PA

I tried sasa's example and that worked. Obsidian, I wasn't necessarily trying to create a CSV file, although someone is sure to ask for a CSV file next instead of the data in an email message, so thanks for that bit of advice.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.