Help - PHP Form Script, Attachment to Email

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Donnamabob
Forum Newbie
Posts: 1
Joined: Mon Jun 08, 2009 3:13 pm

Help - PHP Form Script, Attachment to Email

Post by Donnamabob »

Hi, I'm a graphic designer (not a web programmer), and I'm trying to process an html form and have the information sent to my e-mail. I can only write html, so I've just been taking php scripts off of the internet and trying to make them process my form. Below is the only script that I've gotten to transmit the email, but it's only sending the text. I need it to also send file attachments. Can you even send file attachments to an email? Or would it have to be sent to some sort of directory that's stored on my server (I'd like to avoid doing that if possible since this is already over my head).

Can someone please give me an idea of what I would need to do here. Like I said, I'm not a programmer, so please keep it very simple.

Thank you!


<?PHP

$date = date ("l, F jS, Y");
$time = date ("h:i A");

$msg = "Below is the result of your feedback form. It was submitted on $date at $time.\n\n";

if ($_SERVER['REQUEST_METHOD'] == "POST") {
foreach ($_POST as $key => $value) {
$msg .= ucfirst ($key) ." : ". $value . "\n";
}
}
else {
foreach ($_GET as $key => $value) {
$msg .= ucfirst ($key) ." : ". $value . "\n";
}
}

mail($to, $subject, $msg, $headers);
if ($forward == 1) {
header ("Location:$location");
}
else {
echo "Thank you for submitting our form. We will get back to you as soon as possible.";
}

?>
User avatar
akuji36
Forum Contributor
Posts: 190
Joined: Tue Oct 14, 2008 9:53 am
Location: Hartford, Connecticut

Re: Help - PHP Form Script, Attachment to Email

Post by akuji36 »

Post Reply