I am fairly new to PHP and trying to work with a form on a website. I want it to write the data submitted to a TXT file and also email the information to a particular email address.
The email part is working perfect, and I can write the data to a text file, but the text in the file is being moved to a second line, therefore making it hard to import into Excel or Access. It has been moving the last four items to a second line.
Below is the code I have for the fields and for writing it to the text file:
<?php
$date = $POST['date'];
$time = $POST['time'];
$location = $POST['location'];
$serversname = $POST['serversname'];
$howgreeted = $POST['howgreeted'];
$friendly = $POST['friendly'];
$cleanliness = $POST['cleanliness'];
$quality = $POST['quality'];
$experience = $POST['experience'];
$like_others = $POST['like_others'];
$dined_with_us = $POST['dined_with_us'];
$recommend = $POST['recommend'];
$how_hear = $POST['how_hear'];
$dineindineout = $POST['dineindineout'];
$FullName = $POST['FullName'];
$Phone = $POST['Phone'];
$Email_address = $POST['Email_address'];
$snail_address = $POST['snail_address'];
$comments = $POST['comments'];
$drawing = $POST['drawing'];
if ($drawing) $qdraw = 'Yes';
else $qdraw = 'No';
$today = date("F j, Y, g:i a");
// Insert into the Text File
$data = "$date ; $time ; $location ; $serversname ; $howgreeted ; $friendly ; $cleanliness ; $quality ; $experience ; $like_others ; $dined_with_us ; $recommend ; $how_hear ; $dineindineout ; $FullName ; $Phone ; $Email_address ; $snail_address ; $comments ; $drawing ; $today";
//open the file and choose the mode
$fh = fopen("feedback.txt", "a");
fwrite($fh, $data);
//close the file
fclose($fh);
Any help anybody can provide would be grealy appreciated. I am sure it is something simple, but I have not been able to figure it out.
Thanks!