PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old July 1st, 2004, 10:48 AM
flashpipe flashpipe is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2004
Posts: 1 flashpipe User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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>";
?>

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingPHP Development > PHP Newbie looking for simple file attachment script


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway
Stay green...Green IT