Jump to content

Sending attachments and form results to input field value recipient


arohamack

Recommended Posts

Hi all

First, thanks for any help you can offer!

What I'm trying to do is have a form, when submitted, create an attachment (the attachment appends the form values if it is already created) AND send the form values to myself as well as the person filling in the form (so to the email address in the 'email' field).  I have several php files that do everything except I cant get it to email to the address in the email field and I cant see where I'm going wrong.  I am NOT very php literate and these files were created for me although I understand how they work mostly. 

Thanks!

 

FridgeForm.html code:

<form onclick="return checkFields();" method="post" action="formsubmit.php" id="skopefridge" name="skopefridge" enctype="multipart/form-data">
<p align="right" class="style1 style2"><img src="skope_logo.png" width="235" height="38" border="0">JOB SHEET</p>
<table BORDER=0 RULES=NONE FRAME=BOX cellspacing="2" cellpadding="7">
  <tr>
    <td colspan="2"><strong>Request ID</strong>  <input name="requestid" type="text" class="fieldwidth" id="firstname" maxlength="50" readonly style="background-color:#CCC">
    </label> <strong>Operator Name</strong>    <input name="operator" type="text" id="operator" size="20" maxlength="80"></td>
    <td colspan="3"><strong>Date & Time: </strong>
      <script type="text/javascript" src="time.js"></script></td>
  </tr>
  
  <tr>
    <td colspan="5"><strong>CALLERS DETAILS</strong></td>
  </tr>
  <tr>
    <td>Name</td>
    <td><input name="name" type="text" size="50" tabindex=1></td>
    <td>Night Phone</td>
    <td colspan="2"><input name="nightph" type="text" size="50" tabindex=5></td>
    </tr>
  <tr>
    <td>Street</td>
    <td><input name="street" type="text" size="50" tabindex=2></td>
    <td>Day Phone </td>
    <td colspan="2"><input name="dayph" type="text" size="50" tabindex=6></td>
    </tr>
  <tr>
    <td>Suburb</td>
    <td><input name="suburb" type="text" size="50" tabindex=3></td>
    <td>Mobile</td>
    <td colspan="2"><input name="mobile" type="text" size="50" tabindex=7></td>
    </tr>
  <tr>
    <td>City</td>
    <td><select name="selectcity" size="1" tabindex=4>
      <option value="Alexandra">Alexandra</option>
      <option value="Ashburton">Ashburton</option>
      <option value="Auckland">Auckland</option>
      <option value="Blenheim">Blenheim</option>
      <option value="Canterbury">Canterbury</option>
      <option value="Cromwell">Cromwell</option>
      <option value="Dannevirke">Dannevirke</option>
      <option value="Dargaville">Dargaville</option>
      <option value="Dunedin">Dunedin</option>
      <option value="Fiordland">Fiordland</option>
      <option value="Gisborne">Gisborne</option>
      <option value="Gore c/o Invercargill">Gore c/o Invercargill</option>
      <option value="Greymouth">Greymouth</option>
      <option value="Hamilton">Hamilton</option>
      <option value="Hastings">Hastings</option>
      <option value="Invercargill">Invercargill</option>
      <option value="Kerikeri">Kerikeri</option>
      <option value="Masterton">Masterton</option>
      <option value="Napier">Napier</option>
      <option value="Nelson">Nelson</option>
      <option value="New Plymouth">New Plymouth</option>
      <option value="Oamaru">Oamaru</option>
      <option value="Palmerston North">Palmerston North</option>
      <option value="Queenstown">Queenstown</option>
      <option value="Ranfurly">Ranfurly</option>
      <option value="Rotorua">Rotorua</option>
      <option value="Taupo">Taupo</option>
      <option value="Tauranga/ mt maunganui">Tauranga/ mt maunganui</option>
      <option value="Timaru">Timaru</option>
      <option value="Wanaka">Wanaka</option>
      <option value="Wanganui">Wanganui</option>
      <option value="Wellington">Wellington</option>
      <option value="Westport">Westport</option>
      <option value="Whakatane">Whakatane</option>
      <option value="Whangerei">Whangerei</option>
      <option value="test">test</option>
  <option value="test2">test2</option>
      </select></td>
    <td>Company</td>
    <td colspan="2"><input name="company" type="text" size="50" id="company" tabindex=8></td>
  </tr>
  <tr>
    <td colspan="5"><strong>PRODUCT DETAILS</strong></td>
  </tr>
  <tr>
    <td>Model</td>
    <td><input name="model" type="text" size="50" tabindex=9></td>
    <td>Purchased From </td>
    <td colspan="2"><input name="purchfrom" type="text" size="50" tabindex=11></td>
    </tr>
  <tr>
    <td>Serial No</td>
    <td><input name="serial" type="text" size="50" tabindex=10></td>
    <td>Date Purchased </td>
    <td colspan="2"><input name="datepurch" type="text" size="50" tabindex=12></td>
    </tr>
  <tr>
    <td> </td>
    <td> </td>
    <td>Proof Of Purchase? </td>
    <td colspan="2"><input name="proofpurch" type="text" size="50" tabindex=13></td>
    </tr>
  <tr>
    <td>Room Heater Installed In </td>
    <td colspan="4"><input name="installed" type="text" size="50" tabindex=14></td>
    </tr>
  <tr>
    <td>Heater Problem </td>
    <td colspan="4"><input name="problem" type="text" size="50" tabindex=15></td>
  </tr>
  <tr>
    <td colspan="5" align="center"><span class="style4">FOR ANY PROBLEMS/ENQUIRIES PLEASE CONTACT SKOPE INDUSTRIES PH:0800 947 5673</span>
      </td>
  </tr>
  <tr>
    <td colspan="5" align="center"><hr>      <strong>Contact Belinda at Skope Services if the complete heater needs to be replaced.   &#124;    
      Replaced parts are to be kept for 3 months.    <br>
      <font color="#FF0000">This form is automatically emailed to the contractor associated with the city you choose above. The contractors details are below (for the chosen city) if you need to contact them)</font></strong>
      </td>
  </tr>
  </table>
  

  <table border="0" cellspacing="4" cellpadding="4">
    <tr>
      <td>Contractor</td>
      <td style="display:none;">City</td>
      <td>Address</td>
      <td>Phone</td>
      <td>Fax</td>
      <td>Email</td>
    </tr>
    <tr>
      <td><input type="text" name="contractor" id="contractor" readonly style="background-color:#CCC"></td>
      <td style="display:none;"><input type="text" name="city" id="city" readonly style="background-color:#CCC"></td>
      <td><input type="text" name="address" id="address" readonly style="background-color:#CCC"></td>
      <td><input type="text" name="phone" id="phone" readonly style="background-color:#CCC"></td>
      <td><input type="text" name="fax" id="fax" readonly style="background-color:#CCC"></td>
      <td><input type="text" name="email" id="email" readonly style="background-color:#CCC"></td>
    </tr>
  </table>
  <p>
    <input type="submit" name="Submit" value="Submit" style="width:1000px; height:30px; ">
  </p>
</form>

 

formsubmit.php:

<?php
include ('../tools/maketable.php'); 
include ('../tools/processing.php'); 

$config = "skopeGlobal.php";

/****************************************************************/
/*FORM SUBMITTED DATA                                           */
/****************************************************************/
// These are the fields that are posted from the form to be changed to suit the form
// Make sure that there is one variable per form field or you may miss data

$requestid = $_REQUEST["requestid"];
$operator = $_REQUEST["operator"];
$name = $_REQUEST["name"];
$street = $_REQUEST["street"];
$suburb = $_REQUEST["suburb"];
$selectcity = $_REQUEST["selectcity"];
$nightph = $_REQUEST["nightph"];
$dayph = $_REQUEST["dayph"];
$mobile = $_REQUEST["mobile"];
$company = $_REQUEST["company"];
$model = $_REQUEST["model"];
$serial = $_REQUEST["serial"];
$purchfrom = $_REQUEST["purchfrom"];
$datepurch = $_REQUEST["datepurch"];
$proofpurch = $_REQUEST["proofpurch"];
$installed = $_REQUEST["installed"];
$problem = $_REQUEST["problem"];
$email = $_REQUEST["email"];

$callerInfo = "Request ID=".$requestid."; Operator=".$operator.";  Name=".$name.";  Street=".$street.";  Suburb=".$suburb.";  City=".$selectcity.";  Night Phone=".$nightph.";  Day Phone=".$dayph.";  Mobile Phone=".$mobile.";  Company Name=".$company.";  Model=".$model.";  Serial No=".$serial.";  Purchased From=".$purchfrom.";  Date Purchased=".$datepurch.";  Proof of Purchase=".$proofpurch.";  Room Installed In=".$installed.";  Product Problem=".$problem.";  Emailed To=".$email;
$display .= makeTable("Call Details",$callerInfo,1);


processData($config,$display,$callerInfo);

?>

 

skopeGlobal.php:

<?php
$title = "Skope Fridge Form"; //TODO: The title should be changed to a significant title
$stylesheet = "http://www.thecallcentre.co.nz/css/submittedstyling.css"; // TODO: This Has to be changed to a stylesheet for the site 
                                                                       // this must be a url or email will not style correctly
$logo = "http://www.thecallcentre.co.nz/other/tcclogo.jpg";
$fileName="Skope-FridgeFormResults.xls";
$emailTo=  $_REQUEST["email"];
$emailFrom="info@thecallcentre.co.nz";
$redirect="Thankyou.html";

?>

 

There are also other processing files but I'm not sure if you need to see their code or not. 

 

 

Link to comment
Share on other sites

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.