View Single Post
  #1  
Old 06-18-2009
Asher Asher is offline
Toddler
 
Join Date: Nov 2008
Location: West Midlands, UK
Age: 19
Posts: 19
Rep Power: 0
Asher is on a distinguished road
Lightbulb Adding attatchment facility to basic email script?

Hey people,
On a site I own I have a basic form that is emailed to me when completed, below is the php script behind it, I want to add a single attatchment box so files such as word documents, pdf's, text files can be attatched, I have already added the file upload input to the html form but do not know what needs adding to the script inorder for it to be sent along with the email as an attatchment, I have named the new input 'fileatt', any help?

Cheers

PHP Code:
<?php

   $company 
$_POST['company'];
   
$name $_POST['name'];
   
$number $_POST['number'];
   
$email $_POST['email'];
   
   
$invoice $_POST['invoice'];
   
$delivery $_POST['delivery'];
   
$comments $_POST['comments'];
   
$order1qty $_POST['order1qty'];
    
$order2qty $_POST['order2qty'];
    
$order3qty $_POST['order3qty'];
    
$order4qty $_POST['order4qty'];
    
$order5qty $_POST['order5qty'];
    
$order6qty $_POST['order6qty'];
             
    
$order1 $_POST['order1'];
    
$order2 $_POST['order2'];
    
$order3 $_POST['order3'];
    
$order4 $_POST['order4'];
    
$order5 $_POST['order5'];
    
$order6 $_POST['order6'];

// Contact subject
$subject ="Redlands Print Website Order";
// Details
$message="
        Company: "
.$_POST['company']."\n
        Contact Name: "
.$name."\n
        Contact Number: "
.$number."\n
        Email Address: "
.$email."\n
        Invoice Address: "
.$invoice."\n
        Delivery Address: "
.$delivery."\n\n
        ----------------------------------------
        Order:
        ----------------------------------------\n\n
             "
.$order1." x ".$order1qty."\n
             "
.$order2." x ".$order2qty."\n
             "
.$order3." x ".$order3qty."\n
             "
.$order4." x ".$order4qty."\n
             "
.$order5." x ".$order5qty."\n
             "
.$order6." x ".$order6qty."\n\n
        ----------------------------------------
             Comments:\n"
.$comments."";

// Mail of sender
$mail_from="$email";
// From 
$header="from: Website Order: $company <$mail_from>";

// Enter your email address
$to ='enquiries@redlands-print.co.uk';

$send_contact=mail($to,$subject,$message,$header);

// Check, if message sent to your email
// display message "We've received your information"
if($send_contact){
echo 
"<script>alert('We have received your order, to complete the process please proceed to pay for your order.');</script>";
} else {
  echo 
"<script>alert('Sorry there seems to be a problem with our site, Please try again later');window.history.back();</script>";
}


     
?>
Reply With Quote