bradyj
04-21-2004, 11:14 PM
I've attempted to add to my php form (created with codingforums support :thumbsup:) to email files -- this is for people to send us their resume and coverletter -- by using the PHP method:
http://us4.php.net/manual/en/features.file-upload.php
However, this uploads to a server, not necessarily sending to an email. Can this be done? If so, what variables can I use to add this to my code?
The html file inputs are basic enough:
<input type="hidden" name="MAX_FILE_SIZE" value="50000" />
<input name="coverletter" type="file" size="15" />
<input name="resume" type="file" size="15" />
And the full php form is pretty straight forward:
<?php
$first_name= $_POST['first_name'];
$last_name= $_POST['last_name'];
$title= $_POST['title'];
$company= $_POST['company'];
$address1= $_POST['address1'];
$address2= $_POST['address2'];
$city= $_POST['city'];
$state= $_POST['state'];
$zip= $_POST['zip'];
$country= $_POST['country'];
$email= $_POST['email'];
$phone= $_POST['phone'];
$fax= $_POST['fax'];
$category= $_POST['category'];
$request_category= $_POST['request_category'];
$request= $_POST['request'];
$message= $_POST['message'];
$body = "
First Name: $first_name
Last Name: $last_name
Title: $title
Company: $company
Address:
$address1
$address2
$city
$state
$zip
$country
Email: $email
Phone: $phone
Fax: $fax
Request Category: $request_category
Additional Info: $request
$message
";
if (!isset($email) || !isset($first_name)) {
header("Location: http://www.academystudios.com/error.php ");
}
elseif (empty($email) || empty($first_name)) {
header("Location: http://www.academystudios.com/error.php ");
}
else {
mail("sales@academystudios.com","From: academystudios.com visitor",$body);
header("Location: http://www.academystudios.com/thankyou.php ");
}
?>
Any ideas how to adjust, if I can even accomplish it? I'm trying to keep away from CGI, i've been successful at that for years now :)
http://us4.php.net/manual/en/features.file-upload.php
However, this uploads to a server, not necessarily sending to an email. Can this be done? If so, what variables can I use to add this to my code?
The html file inputs are basic enough:
<input type="hidden" name="MAX_FILE_SIZE" value="50000" />
<input name="coverletter" type="file" size="15" />
<input name="resume" type="file" size="15" />
And the full php form is pretty straight forward:
<?php
$first_name= $_POST['first_name'];
$last_name= $_POST['last_name'];
$title= $_POST['title'];
$company= $_POST['company'];
$address1= $_POST['address1'];
$address2= $_POST['address2'];
$city= $_POST['city'];
$state= $_POST['state'];
$zip= $_POST['zip'];
$country= $_POST['country'];
$email= $_POST['email'];
$phone= $_POST['phone'];
$fax= $_POST['fax'];
$category= $_POST['category'];
$request_category= $_POST['request_category'];
$request= $_POST['request'];
$message= $_POST['message'];
$body = "
First Name: $first_name
Last Name: $last_name
Title: $title
Company: $company
Address:
$address1
$address2
$city
$state
$zip
$country
Email: $email
Phone: $phone
Fax: $fax
Request Category: $request_category
Additional Info: $request
$message
";
if (!isset($email) || !isset($first_name)) {
header("Location: http://www.academystudios.com/error.php ");
}
elseif (empty($email) || empty($first_name)) {
header("Location: http://www.academystudios.com/error.php ");
}
else {
mail("sales@academystudios.com","From: academystudios.com visitor",$body);
header("Location: http://www.academystudios.com/thankyou.php ");
}
?>
Any ideas how to adjust, if I can even accomplish it? I'm trying to keep away from CGI, i've been successful at that for years now :)