Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
PHP E-mail Receive Form Electronic Content Text question
Old 02-04-2009, 12:04 PM PHP E-mail Receive Form Electronic Content Text question
ADeacon's Avatar
Experienced Talker

Posts: 32
Name: Andrew
Location: Texas
Trades: 0
I am using an external PHP file to package the contents of a html form and e-mail it. What was just asked of me is that if they check a certain location in the form (ex. Rochester, Tuscon, etc.) if the form could be sent to a address specific to that checkbox. Below is a link to the form in question and the php code that makes it work. Thanks in advance.

www.drawninwardmedia.com/nursecore2/apply.html

*----PHP----*

<?php
///////////////////////////////////////////////////////////////////
// PERFECT //
// ------- //
// PHP E-mail Receive Form Electronic Content Text //
// File: feedback.php //
// Version: 1.7 (January 20, 2008) //
// Description: Processes a web form to read the user input and //
// then send the data to a predefined recipient. You are //
// free to use and modify this script as you like. //
// Instructions: Go to "http://www.centerkey.com/php". //
// //
// Center Key Software * www.centerkey.com * Dem T. Pilafian //
///////////////////////////////////////////////////////////////////

// Configuration Settings
require('mail/attach_mailer_class.php');
$sendername = 'Form Feedback';
$SendFrom = "applications@nursecore.net";
$SendTo = "applications@nursecore.net";
$SubjectLine = "Request More Info: Apply Submission";
$file = null;
$ThanksURL = "thanks.html"; //confirmation page

// Build Message Body from Web Form Input
foreach ($_POST as $Field=>$Value){
$MsgBody .= "$Field: $Value\r\n";
}
if($_FILES['attachment']['tmp_name'] != ''){
move_uploaded_file($_FILES['attachment']['tmp_name'], './tmp/'.$_FILES['attachment']['name']);
$file = './tmp/'.$_FILES['attachment']['name'];
}
$MsgBody .= "\r\n" . @gethostbyaddr($_SERVER["REMOTE_ADDR"]) . "\r\n" .
$_SERVER["HTTP_USER_AGENT"];
$MsgBody = htmlspecialchars($MsgBody, ENT_NOQUOTES); //make content safe

// Send E-Mail and Direct Browser to Confirmation Page
$mailer = new attach_mailer($sendername, $SendFrom, $SendTo, '', '', $SubjectLine, $MsgBody);
$mailer->extensions = array('.pdf', '.doc', '.docx', '.txt');
if($file != null){
$mailer->create_attachment_part($file);
}
if(!$mailer->process_mail()){
unlink($file);
die('Could not send message. Please try again later.' . " $mailer->show_error_str()");
}
unlink($file);
header("Location: $ThanksURL");
?>
ADeacon is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Reply     « Reply to PHP E-mail Receive Form Electronic Content Text question
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.32560 seconds with 12 queries