|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
PHP Newbie looking for simple file attachment script
I'm new to PHP, and wrote the following page to submit my first form using PHP! It works great, but now I want to add the ability for the user to attach a file that will come through in the email, but am at a loss. I've found several scripts that let you add files, but they're all in functions with all the rest of the code, which I don't need, and am at a loss. Also, I'm using php 4.3.2, and $file is the variable that is currently the file path.
Any help would be greatly appreciated. Here's the php code I'm using for the formmail. TIA <?php $name=$_POST['name']; $name=$_POST['name']; $streetaddress=$_POST['streetaddress']; $city=$_POST['city']; $state=$_POST['state']; $zip=$_POST['zip']; $phone_number=$_POST['phone_number']; $cell_number=$_POST['cell_number']; $email=$_POST['email']; $school=$_POST['school']; $major=$_POST['major']; $availability=$_POST['availability']; $department=$_POST['department']; $comments=$_POST['comments']; $file=$_POST['file']; if ((!$name ) or (!$email)) { echo "Please enter a Name and an Email address for Contact purposes. Thank You"; echo "<p>"; echo "Please use the 'Back' button to continue."; echo "</p>"; echo "<a href='interns3.php' onclick='self.history.back();'>Back</a>"; exit; } $message="Name: $name\n\n"."Address: $streetaddress\n\n"."City: $city\n\n"."State: $state\n\n"."Zip: $zip\n\n"."Phone: $phone_number\n\n"."Cell Phone: $cell_number\n\n"."Email: $email\n\n"."School: $school\n\n"."Major: $major\n\n"."Availability: $availability\n\n"."Department: $department\n\n"."Comments: $comments\n\n".$text; $subject="Internship Contact Form"; mail("myemail@myemail.com","$subject","$message","From:Form.$email\r\nReply-to:$email", "$file"); echo "<p>Thank you for completing our contact form. Your details have been forwarded.</p>"; echo "<p>"; echo $text; echo "</p><a href=home.php'><b>Return to Home Page</b></a>"; ?> |
![]() |
| Viewing: Dev Articles Community Forums > Programming > PHP Development > PHP Newbie looking for simple file attachment script |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|