Kuzin Posted May 21, 2009 Share Posted May 21, 2009 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@email.com"; $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); } ?> Quote Link to comment https://forums.phpfreaks.com/topic/159137-database-mailer/ Share on other sites More sharing options...
MadTechie Posted May 21, 2009 Share Posted May 21, 2009 okay.. but what do you want it to do ? Quote Link to comment https://forums.phpfreaks.com/topic/159137-database-mailer/#findComment-839257 Share on other sites More sharing options...
Kuzin Posted May 21, 2009 Author Share Posted May 21, 2009 Basically, combining the two scripts. I need the first script just to email the data similar the the 2nd script, while still sending the information to the database. Quote Link to comment https://forums.phpfreaks.com/topic/159137-database-mailer/#findComment-839268 Share on other sites More sharing options...
MadTechie Posted May 21, 2009 Share Posted May 21, 2009 if you only want to send an email then read email() in the manual Quote Link to comment https://forums.phpfreaks.com/topic/159137-database-mailer/#findComment-839272 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.