Web Design Forums

Welcome! Please register or log in: Forgot your password? Why register?
You are here: Web Design Forums » Programming Help » PHP » Need some Help with Email Form RSS

Need some Help with Email Form

This thread was started by RSsimon and has been viewed 650 times, and contains 2 replies, with the last reply made by imagn.
Post Reply
1
View RSsimon's reputation
RSsimon, WDF Noob Private message  
Posted June 26 '09 at 10:10 PM
      Posts: 4
Hello everyone, i hope my spelling isnt to bad to understand.

Ok lets start, Ive made a basic form in dreamweaver CS3, Then i had a go at codeing a php script that when someone enters the infomation posted on the form it goes into my domain/sever Email account, the info they have entered shows, all correct ect..

now i want them to beable to send me files, Images. but my coding wont work..
what ive done here is added the image tags there, for the php script. and also on my forms in dreamweaver HTML file format i added the File Field and called the tag image1 - then image2 - then image3... but when it comes into my email it does this. Item image1: /tmp/phpPRkkIb
Item image2: /tmp/phpPRkkIb
Item image3: /tmp/phpPRkkIb

ive hiden my email.. so that would change...

HELP ive been trying for hours n hours


<?php

/* Subject and Email Variables */

    
$emailSubject 'contacts';
    
$webMaster 'Hidenemail@Email';
   
/* Gathering Data Variables */

    
$itemnameField $_POST['itemname'] ;
    
$disField $_POST['dis'] ;    
    
$priceField $_POST['price'] ;  
    
$postField $_POST['post'] ; 
    
$locationField $_POST['location'] ; 
    
$emailField $_POST['email'] ; 
    
$phoneField $_POST['phone'] ; 
    
$image1Field $_POST['image1'] ; 
    
$image2Field $_POST['image2'] ; 
    
$image3Field $_POST['image3'] ; 
    
$agreeField $_POST['agree'] ;  
    
    
$body = <<<EOD
<br><hr><br>
Item name: $itemname <br>
Item Dis: $dis <br>
Item Price: $price <br>
Item post price: $post <b>
Item location: $location <b>
Item email: $email <b>
Item number: $phone <b>
Item image1: $image1 <b>
Item image2: $image2 <b>
Item imagr3: $image3 <b>
Item location: $location <b>
Yes i agree: $agree <b>


EOD;

    
$headers "From: $email\r\n";
    
$headers .= "Content-type: text/html\r\n";
    
$success mail $webMaster$emailSubject$body$headers ) ;



/* Results rendered as HTML */

    
$theResults = <<<EOD
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Thanks </title>
<style type="text/css">
<!--
.style2 {
    font-family: Verdana, Arial, Helvetica, sans-serif;
    font-size: 12px;
    color: #666666;
}
.style3 {
    color: #990000
}
.style4 {color: #333333}
-->
</style>
</head>

<body>
<div>
  <div align="left" class="style2">
    <h2 class="style3">THANK YOU FOR <span class="style4">CONTACTING US</span></h2>
  </div>
</div>
<p>&nbsp;</p>
<div>
  <div align="left" class="style2">Thank you for your interest! Your email will be answered very soon!</div>
</div>
<br />
<br />
<div>
  <div align="left" class="style2"><a href="home.html" class="style3">Return back &gt;&gt;</a></div>
</div>
<p>&nbsp;</p>
</body>
</html>

EOD;
echo 
"$theResults" ;


?>
Last edited June 27 '09 at 01:16 AM by Wired ("fixed bbcode"). Reply

Advertisement Register for free to hide these ads and participate in discussions!

2
1,251 points at 99% Moderator Repute
mlseim, WDF Moderator Private message  
Posted June 27 '09 at 11:00 AM
      Posts: 3,100
First off, your forum needs to have the part in red, so it can send binary files ...

<form action='myscript.php' method='post' enctype='multipart/form-data'>

Then, you need to so some PHP scripting to save the file(s) in a temporary
directory, attach them to the email, and then delete them from the temporary directory.

This is more than we can describe here, so look at some of these:
http://www.google.com/search?hl=en&q... ttach&aqi=g1
If it's zero degrees outside today, and it's supposed to be twice as cold tomorrow, how cold is it going to be?

3
58 points at 100%
imagn, WDF Addict! Home page   Private message  
Posted June 27 '09 at 03:32 PM
      Posts: 156
This is a great class to both send HTML email (and a plain-text equivalent) and attach files.

http://www.phpguru.org/static/htmlMimeMail5

Post Reply

Similar Threads
Thread Thread Starter Forum Replies Last Post
simple form submit to email Johnny G 69 Web Design Discussion 3 November 29 '08 10:25 PM
PHP Contact Form Email Verification Abstract PHP 4 October 27 '08 10:57 PM
HELP WITH .PHP EMAIL FORM l_elliott1 PHP 4 September 30 '08 10:07 AM
Email Form homeboy Javascript, AJAX, and JSON 1 July 5 '05 06:37 PM