enemeth Posted April 18, 2008 Share Posted April 18, 2008 hi there, I have been working on this for days now, and figured i would get some help to finish this little project im on in here so if anyone can help with this little coding problem im having it would be much appreciated, The code works , its intention was to send an attachment with php , which it does, but i cant seem to get all the information from the form on the website to be emailed along with it, heres the code: <?php $my_email = "elainenemeth@hotmail.com"; $from = $_POST['from']; $subject = $_POST['subject']; $message = $_POST['message']; $fileatt = $_FILES['fileatt']['tmp_name']; $fileatt_type = $_FILES['fileatt']['type']; $fileatt_name = $_FILES['fileatt']['name']; $headers = "From: $from"; if (is_uploaded_file($fileatt)) { $file = fopen($fileatt,'rb'); $data = fread($file,filesize($fileatt)); fclose($file); $semi_rand = md5(time()); $mime_boundary = "==Multipart_Boundary_x{$semi_rand}x"; $headers .= "\nMIME-Version: 1.0\n" . "Content-Type: multipart/mixed;\n" . " boundary=\"{$mime_boundary}\""; $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"; $data = chunk_split(base64_encode($data)); $message .= "--{$mime_boundary}\n" . "Content-Type: {$fileatt_type};\n" . " name=\"{$fileatt_name}\"\n" . "Content-Transfer-Encoding: base64\n\n" . $data . "\n\n" . "--{$mime_boundary}--\n"; } $ok = @mail($my_email, $subject, $message, $headers); if ($ok) { echo "<p>Mail sent! Yay PHP!</p>"; } else { echo "<p>Mail could not be sent. Sorry!</p>"; } [code=php:0] the form is here: <form action="mail.php" method="POST" enctype="multipart/form-data"> <table border="0" width="99%"> <tr> <td width="69%" align="right" colspan="2"> </td> </tr> <tr> <td width="31%" align="right"><font face="Arial" font size="2" font color="#333333"> Name: </font> </td> <td width="38%"><input type="text" name="from" size="25"></td> </tr> <tr> <td width="31%" align="right"><font size="2" font face="Arial" color="#333333">Your Specialty: </font> </td> <td width="38%"><select size="1" name="subject"> <option>Accounting & Finance</option> <option>Advertising & Marketing</option> <option>Aerospace & Avionics</option> <option>Consumer Products</option> <option>Engineering</option> <option>Hospitality</option> <option>Human Resources</option> <option>Manufacturing/Supply Chain</option> <option>Medical/Biotech/Pharmaceutical</option> <option>Technology</option> <option>Other</option> </select><font face="Arial" size="2">other<input type="text" name="email" size="18"></font></td> </tr> <tr> <td width="31%" align="right"><font face="Arial" font size="2" font color="#333333">Email: </font> </td> <td width="38%"><input type="text" name="phone" size="25"></td> </tr> <tr> <td width="31%" align="right"><font face="Arial" font size="2" font color="#333333">Phone Number: </font> </td> <td width="38%"><input type="text" name="message" size="25"></td> </tr> <tr> <td width="31%" align="right"><font size="2" face="Arial" color="#333333">Resume: (word document only)</font> </td> <td width="38%"><input type="file" name="fileatt" /></td> </tr> </table> <p align="center"><input type="submit" value="Send" /><input type="reset" value="Reset" name="B2"></p> </form> It would be wonderful if someone can tell me what i am missing to get the email address, the phone number included in the email that is sent ! thank you much Elaine Quote Link to comment Share on other sites More sharing options...
enemeth Posted April 18, 2008 Author Share Posted April 18, 2008 anyone ?? any ideas? Elaine Quote Link to comment Share on other sites More sharing options...
shreej21 Posted April 18, 2008 Share Posted April 18, 2008 hello... you need to add $mail=$_POST['mail']; $phone=$_POST['phone']; and include this fields in your mail. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.