Skip navigation
Currently Being Moderated

how to add attachment field to form

Mar 14, 2012 1:33 PM

Tags: #automatically #cs5 #dreamweaver #email #form #attachment #send #attach

I need to create a feild on my form where people will be able to attach a photo. I already have the form created, and a .php file which sends the email and redirects them back. I have searched this forum and google, but can't seem to find a solution for this.

 

Here is my form code:

 

<form action="merchantsignup.php" method="post" id="contact_form">

    <center><table width="637" border="0">

      <tr>

        <td>Business Name:

  <br />

    <input type="text" name="name" /></td>

        <td>Business Phone:

  <br />

    <input type="text" name="phone" /></td>

        <td>Business Email:

  <br />

    <input type="text" name="email" /></td>

      </tr>

      <tr>

        <td>Business Address:

  <br />

    <input type="text" name="address" /></td>

        <td>City & Zip:

  <br />

    <input type="text" name="city/zip" /></td>

        <td>Business Webpage:

  <br />

    <input type="text" name="webpage" /></td>

      </tr>

      <tr>

        <td>Main Category:

  <br />

    <input type="text" name="category1" /></td>

        <td>Sub Category:

  <br />

    <input type="text" name="category2" /></td>

        <td>Attach a Photo:

  <br />

    <input type="text" name="photo" /></td>

      </tr>

      <tr>

      </table>

        <td>

        About the Business:

  <br />

    <textarea cols="88" rows="8" name="about"></textarea>

 

 

</h3>

  <p><input type="submit" name="submit" value="Send" />

  <input type="reset" name="reset" value="Clear Form" /></p>

    </form>

 

 

And here is my .php file:

 

 

<?php

 

 

/* Email Variables */

 

 

$emailSubject = 'contactformprocess!';

$webMaster = 'info@lf.com';

 

 

 

 

/* Data Variables */

 

 

$name = $_POST['name'];

$phone = $_POST['phone'];

$email = $_POST['email'];

$address = $_POST['address'];

$city = $_POST['city/zip'];

$webpage = $_POST['webpage'];

$category1 = $_POST['category1'];

$category2 = $_POST['category2'];

$photo = $_POST['photo'];

$about = $_POST['about'];

 

 

 

 

 

 

$body = <<<EOD

<br><hr><br>

Name: $name <br>

Phone: $phone <br>

Email: $email <br>

Address: $address <br>

City: $city <br>

Wegpage: $webpage <br>

Category1: $category1 <br>

Category2: $category2 <br>

Photo: $photo <br>

About: $about <br>

 

 

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

<html>

<head>

<title>sent message</title>

<meta http-equiv="refresh" content="3;URL=http://lf.shtml">

<style type="text/css">

<!--

body {

background-color: #444;

font-family: Verdana, Arial, Helvetica, sans-serif;

font-size: 20px;

font-style: normal;

line-height: normal;

font-weight: normal;

color: #fec001;

text-decoration: none;

padding-top: 200px;

margin-left: 150px;

width: 800px;

}

 

 

-->

</style>

</head>

<div align="center">Your email will be answered soon as possible!

You will return to home in a few seconds !</div>

</div>

</body>

</html>

EOD;

echo "$theResults";

?>

 

 

 

Any input would be more than greatly appreciated!

 
Replies

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points