Jump to content

In desperate need of help - php contact form with file upload emailed


Recommended Posts

I am a beginner and am trying to create a contact form that allows a document upload and then I'd like all the data fields and the uploaded document emailed to me.  So far, I think that I have the form coded correctly, but haven't a clue of what the coding should look like to include the uploaded file.  The form works currently, I'm just now trying to add the file upload feature. 

 

Here is my actual form:  http://www.wevins.com/Dev/proposalrequest.php

 

Here is the thank you page:  http://www.wevins.com/Dev/proposalrequest-thankyou.php

 

Please help and let me know what code I am missing to get this to work.  I did not want the uploaded files stored on our server, I just want the files emailed to me.

Here is the form code...it's very long and definitely not as "neat" as many other posts on here:

 

<form name="proposalrequest" method="POST" action="http://www.wevins.com/Dev/proposalrequest-quotethankyou.php" enctype="multipart/form-data">

<table border="0" width="100%" cellspacing="0" cellpadding="0">

<tr>

<td colspan="2">

<font face="Verdana" color="#001D61">

How many full-time employees are currently

participating in your group health insurance policy?<br>

 </font></td>

</tr>

<tr>

<td colspan="2">    

<input type="checkbox" name="_1_20employees" value="1-20 employees">

1-20       

<input type="checkbox" name="_21_50employees" value="21-50 Employees">

21-50       

<input type="checkbox" name="_51_100employees" value="51-100 employees">

51-100       

<input type="checkbox" name="_100_plus_employees" value="100+ employees">

101+</td>

</tr>

<tr>

<td colspan="2"> </td>

</tr>

<tr>

<td colspan="2"><font color="#001D61"><br>

What month does your current group

health insurance renew?<br>

 </font></td>

</tr>

<tr>

<td colspan="2"><font color="#001D61">     Health:                          Life:                               Disability:</font></td>

</tr>

<tr>

<td colspan="2"><font color="#001D61">    

<select size="1" name="healthrenewal">

<option>- Please Select -</option>

<option>January</option>

<option>February</option>

<option>March</option>

<option>April</option>

<option>May</option>

<option>June</option>

<option>July</option>

<option>August</option>

<option>September</option>

<option>October</option>

<option>November</option>

<option>December</option>

<option>Not Offered</option>

</select>    

<select size="1" name="liferenewal">

<option>- Please Select -</option>

<option>January</option>

<option>February</option>

<option>March</option>

<option>April</option>

<option>May</option>

<option>June</option>

<option>July</option>

<option>August</option>

<option>September</option>

<option>October</option>

<option>November</option>

<option>December</option>

<option>Not Offered</option>

</select>    

<select size="1" name="disabilityrenewal">

<option>- Please Select -</option>

<option>January</option>

<option>February</option>

<option>March</option>

<option>April</option>

<option>May</option>

<option>June</option>

<option>July</option>

<option>August</option>

<option>September</option>

<option>October</option>

<option>November</option>

<option>December</option>

<option>Not Offered</option>

</select></font></td>

</tr>

<tr>

<td colspan="2"> </td>

</tr>

<tr>

<td colspan="2"><font color="#001D61">    

Dental:                          Vision:</font></td>

</tr>

<tr>

<td colspan="2">     <font color="#001D61">

<select size="1" name="dentalrenewal">

<option>- Please Select -</option>

<option>January</option>

<option>February</option>

<option>March</option>

<option>April</option>

<option>May</option>

<option>June</option>

<option>July</option>

<option>August</option>

<option>September</option>

<option>October</option>

<option>November</option>

<option>December</option>

<option>Not Offered</option>

</select>    

<select size="1" name="visionrenewal">

<option>- Please Select -</option>

<option>January</option>

<option>February</option>

<option>March</option>

<option>April</option>

<option>May</option>

<option>June</option>

<option>July</option>

<option>August</option>

<option>September</option>

<option>October</option>

<option>November</option>

<option>December</option>

<option>Not Offered</option>

</select></font></td>

</tr>

<tr>

<td colspan="2"> </td>

</tr>

<tr>

<td colspan="2"><font color="#001D61"><br>

Who is your current insurance

carrier?<br>

 </font></td>

</tr>

<tr>

<td colspan="2">    

<input type="text" name="currentprovider" size="56"></td>

</tr>

<tr>

<td colspan="2"> </td>

</tr>

<tr>

<td colspan="2"><br>

<font color="#001D61">Please list your company's

SIC Code or the nature of your business.</font><br>

 </td>

</tr>

<tr>

<td colspan="2">    

<input type="text" name="sic" size="56"></td>

</tr>

<tr>

<td colspan="2">

<p>

<font face="Verdana" color="#001D61"><br>

Would you like information

on alternative insurance funding options such as

Health Savings Accounts, Health Reimbursement

Accounts or Flexible Spending Accounts?<br>

 </font></td>

</tr>

<tr>

<td colspan="2">    

<input type="checkbox" name="alternativefunding_yes" value="Yes"><font color="#001D61">

Yes </font>        

<input type="checkbox" name="alternativefunding_no" value="No">

<font color="#001D61">No</font></td>

</tr>

<tr>

<td colspan="2"> </td>

</tr>

<tr>

<td colspan="2">

<p>

<font face="Verdana" color="#001D61"><br>

How would you

like to be contacted to review your proposals?<br>

 </font></td>

</tr>

<tr>

<td colspan="2">    

<input type="checkbox" name="telephone" value="Telephone">

<font color="#001D61">Telephone </font>        

<input type="checkbox" name="emailed" value="Email"><font color="#001D61">

Email </font>        

<input type="checkbox" name="mailedinformation" value="Mailed Information">

<font color="#001D61">Mailed Information</font></td>

</tr>

<tr>

<td colspan="2"> </td>

</tr>

<tr>

<td colspan="2"><font color="#001D61"><br>

If you have

any additional questions or comments, please type

them below.<br>

 </font></td>

</tr>

<tr>

<td colspan="2">

<p align="center">

<textarea rows="5" name="comments" cols="52"></textarea></td>

</tr>

<tr>

<td colspan="2"> </td>

</tr>

<tr>

<td colspan="2"><font color="#001D61">Contact Information:</font><br>

 </td>

</tr>

<tr>

<td width="26%"><font color="#001D61">     Name:</font></td>

<td width="74%">

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

</tr>

<tr>

<td><font color="#001D61">     Title:</font></td>

<td><input type="text" name="title" size="39"></td>

</tr>

<tr>

<td><font color="#001D61">     Company:</font></td>

<td><input type="text" name="company" size="39"></td>

</tr>

<tr>

<td><font color="#001D61">     Address:</font></td>

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

</tr>

<tr>

<td><font color="#001D61">     City, State, Zip:</font></td>

<td>

<input type="text" name="citystatezip" size="39"></td>

</tr>

<tr>

<td><font color="#001D61">     Phone:</font></td>

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

</tr>

<tr>

<td><font color="#001D61">     Email:</font></td>

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

</tr>

<tr>

<td colspan="2"> </td>

</tr>

<tr>

<td colspan="2"><br>

Please upload your current census information: <p>

<br>

                                            

<input type="file" name="censusfile" size="31"></td>

</tr>

<tr>

<td colspan="2"> </td>

</tr>

<tr>

<td colspan="2">Please upload your current plan

design:<p><br>

                                            

<input type="file" name="currentplandesign" size="31"></td>

</tr>

<tr>

<td colspan="2"> <p> </td>

</tr>

</table>

<p align="center"> 

  <input type="submit" value="Submit Information" style="font-size: 8pt; font-family: Verdana"><br> </p>

<input type="hidden" name="submit" value="1">

</form>

 

 

HERE IS THE PHP HANDLER CODE:

 

if ($_POST["submit"]) {

  $headers = "From: ".$_POST["name"]." <".$_POST["email"].">";

  $message = "Name: ".$_POST["name"]."\nTitle: ".$_POST["title"]."\nCompany: ".$_POST["company"]."\nAddress: ".$_POST["address"]."\nCity, State, Zip: ".$_POST["citystatezip"].

  "\nPhone: ".$_POST["phone"]."\nEmail: ".$_POST["email"]."\n\nNumber of Full Time Employees: ".$_POST["_1_20employees"]."".$_POST["_21_50employees"]."".$_POST["_51_100employees"]."".$_POST["_100_plus_employees"].

  "\n\nCurrent Policy Renewal:\n  Group Health: ".$_POST["healthrenewal"]."\n  Group Life: ".$_POST["liferenewal"]."\n  Group Disability: ".$_POST["disabilityrenewal"]."\n  Group Dental: ".$_POST["dentalrenewal"]."\n  Group Vision: ".$_POST["visionrenewal"].

  "\n\nCurrent Insurance Provider or Broker: ".$_POST["currentprovider"].

  "\n\nSIC Code or Nature of Business: ".$_POST["sic"].

  "\n\nWould You Like Information on Alternative Funding Options: ".$_POST["alternativefunding_yes"]."".$_POST["alternativefunding_no"].

  "\n\nHow Would You Like To Be Contacted: ".$_POST["telephone"]."".$_POST["emailed"]."".$_POST["mailedinformation"]."\n\nComments: ".$_POST["comments"];

  mail("[email protected]", "Quote Request", $message, $headers);

  //print "<center><h2>We have received your message and will be in touch shortly.</h2></center>";

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.