Thank you very much for your help. Moonbrat
:xbones: :xbones: you can probably tell how amateur I am at php programming, cos I couldn't get the below code to run at all after I have made reference to this php in the form.
In the html, user would input data, and include an attachment, the fields are exactly as the names listed below
for the attachment, I have named it name="file1"
<form method="post" action="sendmail.php">
sendmail.php
<html>
<body>
<?php
$from = $POST['EmailAddress'];
$title = $POST['gender'];
$First = $POST['First_Name'];
$Last = $POST['Last_Name'];
$Phone = $POST['Phone_Number'];
$Country= $POST['Country'];
$Comments = $_POST['Comments'];
$fileatt = $FILES['file1']['tmp_name'];
$fileatt_type = $FILES['file1']['type'];
$fileatt_name = $_FILES['file1']['name'];
if((!$from == "") && (!strstr($from,"@") || !strstr($from,".")))
{
echo "<h2>Use Back - Enter valid e-mail</h2>\n";
$tellem = "<h2>Feedback was NOT submitted</h2>\n";
}
if(empty($First) || empty($Last) || empty($from)) {
echo "<h2>Use Back - fill in all required fields</h2>\n";
}
$headers = "From: $from";
if (is_uploaded_file($fileatt)) {
// Read the file to be attached ('rb' = read binary)
$file = fopen($fileatt,'rb');
$data = fread($file,filesize($fileatt));
fclose($file);
// Generate a boundary string
$semi_rand = md5(time());
$mime_boundary = "==Multipart_Boundary_x{$semi_rand}x";
// Add the headers for a file attachment
$headers .= "\nMIME-Version: 1.0\n" .
"Content-Type: multipart/mixed;\n" .
" boundary=\"{$mime_boundary}\"";
// Add a multipart boundary above the plain message
$message = "This is a multi-part message in MIME format.\n\n" .
"--{$mime_boundary}\n" .
"Content-Type: text/plain; charset=\"iso-8859-1\"\n" .
"Content-Transfer-Encoding: 7bit\n\n" .
$message . "\n\n";
// Base64 encode the file data
$data = chunk_split(base64_encode($data));
// Send the message
$ok = @mail("mymail", $from, $title, $First, $Last, $Phone, $Country, $Comment, $headers);
if ($ok) {
echo "<p>Mail sent! Thank you for signing up !</p>";
} else {
echo "<p>Mail could not be sent. Sorry!</p>";
}
?>
</body>
</html>
I'd really appreciate some help. Thanks a million