Hello,
I'm a novice with PHP. I have a problem getting a PHP script that in theory, should take a checkbox value in an HTML form (Mesa, Tucson, etc.) and apply it to an email, which resides in an array. It might be hung up on a function to include an attachment that the script contains as this particular form doesn't have that option. However, when I remove the attachment script, I get the same error. I'll include the PHP below as well as a link to the HTML form in question. Any pointers you can give me would be most appreciated. Thank you.
/---PHP---/
<?php
// Configuration Settings
require('mail/attach_mailer_class.php');
$sendername = 'Form Feedback';
$SendFrom = "ncapps@drawninwardmedia.com";
$SendTo = "ncapps@drawninwardmedia.com";
$CC = '';
$SubjectLine = "Request More Info: Full Application";
$file = null;
$ThanksURL = "thanks.html"; //confirmation page
// build list of office emails ($key = city $address = email address)
$locations = array();
$locations['Albany'] = 'dont@email.me';
$locations['Arlington'] = 'dont@email.me';
$locations['Clearwater'] = 'dont@email.me';
$locations['Colorado_Springs'] = 'dont@email.me';
$locations['Denver'] = 'dont@email.me';
$locations['Ft_Myers'] = 'dont@email.me';
$locations['Ft_Worth'] = 'dont@email.me';
$locations['Gainesville'] = 'dont@email.me';
$locations['Vegas'] = 'dont@email.me';
$locations['Mesa'] = 'dont@email.me';
$locations['Miami'] = 'dont@email.me';
$locations['Ocala'] = 'dont@email.me';
$locations['Phoenix'] = 'dont@email.me';
$locations['Port_Charlotte'] = 'dont@email.me';
$locations['Santa_Barbara'] = 'dont@email.me';
$locations['Santa_Maria'] = 'dont@email.me';
$locations['Sarasota'] = 'dont@email.me';
$locations['St_Petersburg'] = 'dont@email.me';
$locations['Syracuse'] = 'dont@email.me';
$locations['Tucson'] = 'dont@email.me';
// build email list string
foreach($_POST['interested_in'] as $location){
if($CC != '')
$CC .= ",$locations[$location]";
else
$CC .= $locations[$location];
}
// 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, $CC, '', $SubjectLine, $MsgBody);
$mailer->extensions = array('.pdf', '.doc', '.docx', '.txt');
if($file != null){
$mailer->create_attachment_part($file);
}
if(!$mailer->process_mail()){
if($file != null)
unlink($file);
die('Could not send message. Please try again later.' . " $mailer->show_error_str()");
}
else
if($file != null){
unlink($file);
}
header("Location: $ThanksURL");
?>
/---END OF PHP---/
http://drawninwardmedia.com/nursecore/new_full_app.html
The checkboxes that pertain to the array are on part 3 of the form. Again, thanks for any help you may be able to provide.