Jump to content

Database & Mailer


Kuzin

Recommended Posts

I'm rather bad at php. And thus, i'm having a problem.

I need to take a database post script that i've created, and

add email functionality, similar to the 2nd script below.

 

I've run into a mental dead end, and cannot figure how to continue.

 

Any help would be highly appreciated.

 

 

<?php

$first_name = "first_name";
$last_name = "last_name";
$company_name = "company_name";
$email = "email";
$phone = "phone";
$event_date = "event_date";
$event_location = "event_location";
$howDidHearAbtUs = "howDidHearAbtUs";
$referral = "referral";
$comments = "comments";


$sid = "0000000000000000000000"; 
$data_arr[]="sid=".$sid;
$data_arr[]="first_name=".$first_name;
$data_arr[]="last_name=".$last_name;
$data_arr[]="company=".$company_name;
$data_arr[]="email=".$email;
$data_arr[]="phone=".$phone;
$data_arr[]="event_date=".$event_date;
$data_arr[]="event_location=".$event_location;
$data_arr[]="lead_source=".$howDidHearAbtUs;
$data_arr[]="referral=".$referral;
$data_arr[]="comments=".$comments;
$data_arr[]="submit=submit";



$host = "http://www.gigbooks.com"; 
$method = "POST";
$path = "/contactus_request.php";
$data = implode("&",$data_arr);


$url=$host.$path;

$ch = curl_init($url);
curl_setopt ($ch, CURLOPT_POST, 1);
curl_setopt ($ch, CURLOPT_POSTFIELDS, $data);
curl_exec ($ch);
curl_close ($ch);



?> 

 

 

 

<?php
if(isset($_POST['submit'])) {
$to = "[email protected]";
$subject = "[ MCN | SALON ]" . " " . $_POST['name'];
$name_field = $_POST['name'];
$email_field = $_POST['email'];
$phone_field = $_POST['phone'];
$message = $_POST['message'];

$body = "From ::\t$name_field\nE-Mail ::\t$email_field\nPhone ::\t$phone_field\nMessage ::\n$message\n\n\n\n [ Email Generated from MCNSALON.COM ]";

mail($to, $subject, $body);
}

?>

Link to comment
https://forums.phpfreaks.com/topic/159137-database-mailer/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.