Hi all,
Looking for some advice on the mailing list module, I have created a php form for a client, this form sends the client an email and stores the information in a .csv file. My issue is, the client want’s to also, grab the email address and save it into the expression engine mailing list module.
My question is, how will I combine my php script with the expression engine mailing list module? Also, I don’t want to use the expression engine thank you page, I want the php form to run as it has been set up.
My php script is:
<?php
$Name = $_POST['name']; //senders name
$phonenum = $_POST['phonenum']; //senders phone number
$email = $_POST['email'];
$location = $_POST['location'];
$noguests = $_POST['noguests'];
$day = $_POST['day'];
$month = $_POST['month'];
$year = $_POST['year'];
$hour = $_POST['hour'];
$minute = $_POST['minute'];
$addcom = $_POST['addcom'];
$to = "[email protected]"; //recipient
$fs = fopen("bookings.csv","a");
fwrite($fs,"\n" . $Name . ", " . $phonenum . ", " . $email . ", " . $location . ", " . $noguests . ", " . $day . "-" . $month . "-" . $year . ", " . $hour . ":" . $minute . ", " . $addcom);
fclose($fs);
$subject = "Booking for ".$_POST['day']."-".$_POST['month']."-".$_POST['year']; //subject
$message = "Name: ".$_POST['name']."\r\n".
"Phone Number: ".$_POST['phonenum']."\r\n".
"Email: ".$_POST['email']."\r\n".
"Location: ".$_POST['location']."\r\n".
"Number Of Guests: ".$_POST['noguests']."\r\n".
"Date: ".$_POST['day']."-".$_POST['month']."-".$_POST['year']."\r\n".
"Time: ".$_POST['hour'].":".$_POST['minute']."\r\n".
"Comments: ".$_POST['addcom']; //mail body
$from = "Booking Form"; //
$headers = "From: ".$from."\r\n"; //optional headerfields
mail($to, $subject, $message, $headers); //mail command :blush: you can add any variable here… I know you have so many, but it is possible…
?>
strong>Thank you…</strong>
We will be in touch soon to confirm your booking.
Thanks.