Ok I now have the following code after adding PHPMailer:
<?php
$name = $_POST['id'];
$email = $_POST['username'];
$password = md5($_POST['password']);
$usergroup = $_POST['usergroup'];
$lastsid = $_POST['lastsid'];
$fname = $_POST['fname'];
$lname = $_POST['lname'];
$lastaccess = $_POST['lastaccess'];
$company = $_POST['company'];
$phone = $_POST['phone'];
$addone = $_POST['addone'];
$addtwo = $_POST['addtwo'];
$city = $_POST['city'];
$stateprov = $_POST['stateprov'];
$country = $_POST['country'];
$postalcode = $_POST['postalcode'];
$rescom = $_POST['rescom'];
$addbook = $_POST['addbook'];
$subscriptions = $_POST['subscriptions'];
$affilid = $_POST['affilid'];
$affilcommpct = $_POST['affilcommpct'];
$affilsalestodate = $_POST['affilsalestodate'];
$affilcommearned = $POST['affilcommearned'];
$affilcommowed = $_POST['$affilcommowed'];
$affilcommpaid = $_POST['affilcommpaid'];
$whlsalepct = $_POST['whlsalepct'];
$show_currency = $_POST['show_currency'];
$loyaltypoints = $_POST['loyaltypoints'];
$fp = fopen("feed.csv", "w+");
$savestring = $name . "," . $email . "," . $password . "," . $usergroup . "," . $lastsid . "," . $fname . "," . $lname . "," . $lastaccess . "," . $company . "," . $phone . "," . $addone . "," . $addtwo . "," . $city . "," . $stateprov . "," . $country . "," . $postalcode . "," . $rescom . "," . $addbook . "," . $subscriptions . "," . $affilid . "," . $affilcommpct . "," . $affilsalestodate . "," . $affilcommearned . "," . $affilcommowed . "," . $affilcommpaid . "," . $whlsalepct . "," . $show_currency . "," . $loyaltypoints . "\n";
fwrite($fp, $savestring);
fclose($fp);
echo "<h1>Thank you.</h1><p>We will confirm your details and send your new account details via email within the next working day.</p><p><a href='test2.php'>Back to main page</a></p>";
/* email finished file */
require_once('/public_html/xx/class.phpmailer.php');
$email = new PHPMailer();
$email->From = 'my@emailaddress;
$email->FromName = 'test name';
$email->Subject = 'Form Test';
$email->Body = $bodytext;
$email->AddAddress( 'my@emailaddress' );
$file_to_attach = '/public_html/xx/';
$email->AddAttachment( $file_to_attach, 'formdata.csv' );
return $email->Send();
?>
Nothing happens! Please could anyone advise? I am now getting no error logs
I have also tried to write $searchstring as fputcsv() with no success. I need to workaround this as I do have one field for checkboxes where the options are separated by comma.
Please help, I really do appreciate your feedback. :)