Question : How do I modify this php script to send a confirmation?

I have a php script that sends the field values of an online form to three email addresses. I want to add a confirmation email to the sender who filled out the form. I want that confirmation email to have a different 'From' email address, a different 'Subject' and a short message preceding the display of the same form values. Pretty common, I suppose. I don't write php and my programmer is not available.

The script has already been modified to do a couple of the items above:
It will send an email to the user (sender), and the email shows the form values.

But, the Subject and Message and From are the same as the one that goes to the form owner.

What I want the user to receive is something like:

From: [email protected]
Subject: Your request for a moving quote has been received

Message:

Thank you yada yada. Below is the info you provided. We'll get back to you asap yada yada. Or you can always call us at such and such.

name: value
name: value
name: value
etc.
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
117:
118:
119:
120:
121:
122:
123:
124:
125:
126:
127:
128:
129:
130:
131:
132:
133:
134:
135:
136:
137:
138:
139:
140:
141:
142:
143:
144:
145:
146:
147:
148:
149:
150:
151:
152:
153:
154:
155:
156:
157:
158:
159:
160:
161:
162:
163:
164:
165:
166:
167:
168:
169:
170:
171:
172:
173:
174:
175:
176:
177:
178:
<?php

//$where_form_is="http://".$_SERVER['SERVER_NAME'].strrev(strstr(strrev($_SERVER['PHP_SELF']),"/"));

session_start();
if( ($_SESSION['security_code']==$_POST['security_code']) && (!empty($_POST['security_code'])) ) { 

$headers  = "MIME-Version: 1.0 \r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1 \r\n";
//$headers .= "From: "[email protected]" \n";
$headers .= "From: " . $_POST['field_8'] . " \n";
$headers .= "Reply To: " . $_POST['field_8'] . " \n";

//$to  = '[email protected];[email protected];[email protected]';
$to  = '[email protected];[email protected];[email protected]';

//$to  = '[email protected]';

$subject = 'Moving Quote Request';

$message = "<br />
Referrer: " . $_POST['field_r'] . " <br />
Approximate move date: " . $_POST['field_1'] . " <br />
Moving from ZIP: " . $_POST['field_2'] . " <br /> 
Moving to ZIP: " . $_POST['field_4'] . " <br />
Description: moving from: " . $_POST['field_3'] . "; moving to: " . $_POST['field_5'] . " <br />
First name: " . $_POST['field_6'] . " <br />
Last name: " . $_POST['field_7'] . " <br />
Your email: " . $_POST['field_8'] . " <br />
Home phone: " . $_POST['field_9'] . " <br />
Mobile phone: " . $_POST['field_10'] . " <br />
Fax: " . $_POST['field_11'] . " <br /><br />

Living and Family Areas: <br /><br />

Sofa or Loveseat: " . $_POST['field_12'] . " <br />
Hide-A-Bed or Recliner Sofa: " . $_POST['field_13'] . " <br />
Sectional Sofa Pieces: " . $_POST['field_14'] . " <br />
Large Chair, Recliners, Rockers: " . $_POST['field_15'] . " <br />
Ottoman, stool, foot stool: " . $_POST['field_16'] . " <br />
Coffee Table or Sofa Tables: " . $_POST['field_17'] . " <br />
End Tables or Small stands: " . $_POST['field_18'] . " <br />
Bench: " . $_POST['field_19'] . "  <br />
Area Rugs: " . $_POST['field_20'] . "  <br />
Entertainment Center: " . $_POST['field_21'] . "  <br />
Bookcase or Wall Unit Sections: " . $_POST['field_22'] . "  <br />
TV 26 in or Smaller: " . $_POST['field_24'] . "  <br />
TV 27 in to 39 in: " . $_POST['field_25'] . "  <br />
TV 40 in to 60 in: " . $_POST['field_26'] . "  <br />
TV Stereo Stands: " . $_POST['field_27'] . "  <br />
Pianos Spinet: " . $_POST['field_28'] . "  <br />
Pianos Upright: " . $_POST['field_29'] . "  <br />
Organ: " . $_POST['field_30'] . "  <br />
Grandfather Clock: " . $_POST['field_31'] . "  <br /><br />

Kitchen and Dining Areas   <br /><br />

Dining Table or Kitchen Table: " . $_POST['field_32'] . "  <br />
Chairs, Dining, kitchen,: " . $_POST['field_33'] . "  <br />
Buffet or Sideboard: " . $_POST['field_34'] . "  <br />
China Cabinet or Hutch (pcs): " . $_POST['field_35'] . "  <br />
Curio Cabinet: " . $_POST['field_36'] . "  <br />
Bakers Rack: " . $_POST['field_37'] . "  <br />
Refrigerator or Freezer: " . $_POST['field_38'] . "  <br />
Side by Side Refrigerator: " . $_POST['field_39'] . "  <br />
Microwave or Kitchen Cart: " . $_POST['field_40'] . "  <br />
Stove/Oven: " . $_POST['field_41'] . "  <br />
Washer or Dryer: " . $_POST['field_42'] . "  <br />
Iron Board or Vacuum: " . $_POST['field_43'] . "  <br /><br />

Bedroom Area   <br />

King or Queen Beds: " . $_POST['field_44'] . "  <br />
Full or Twin Beds: " . $_POST['field_45'] . "  <br />
Waterbed: " . $_POST['field_46'] . "  <br />
Bunk Bed: " . $_POST['field_47'] . "  <br />
Crib or Tot Bed: " . $_POST['field_48'] . "  <br />
Daybed or Futon Bed: " . $_POST['field_49'] . "  <br />
Nightstands or Small Stands: " . $_POST['field_50'] . "  <br />
Dresser: " . $_POST['field_52'] . "  <br />
Chest of Drawers: " . $_POST['field_53'] . "  <br />
Cedar Chest, Footlocker, Trunk: " . $_POST['field_51'] . "  <br />
Armoire or Wardrobe: " . $_POST['field_54'] . "  <br />
Mirror: " . $_POST['field_55'] . "  <br />
Wardrobe Boxes Approx. 2 Ft of Clothes: " . $_POST['field_56'] . "  <br />
Sewing Machine or Toy box: " . $_POST['field_57'] . "  <br />
Vanity: " . $_POST['field_58'] . "  <br />
Changing Table: " . $_POST['field_59'] . "  <br />
Hamper: " . $_POST['field_60'] . "  <br /><br />

Office and Study Areas   <br /><br />

Large Desk: " . $_POST['field_61'] . "  <br />
Small Desk: " . $_POST['field_62'] . "  <br />
Credenza: " . $_POST['field_65'] . "  <br />
Desk Chairs: " . $_POST['field_66'] . "  <br />
Filing Cabinet: " . $_POST['field_67'] . "  <br />
Computer Equipment: " . $_POST['field_68'] . " <br />
Desk Copier: " . $_POST['field_69'] . "   <br /><br />

Exercise Areas   <br /><br />

Stair Stepper: " . $_POST['field_70'] . "  <br />
Exercise Bike: " . $_POST['field_71'] . "  <br />
Row Machine: " . $_POST['field_72'] . "  <br />
Weight Bench: " . $_POST['field_73'] . "  <br />
Treadmill: " . $_POST['field_74'] . "  <br /><br />

Garage and Outdoors   <br /><br />

Workbench: " . $_POST['field_91'] . "  <br />
Tool chest 2-man to lift: " . $_POST['field_92'] . "  <br />
Toolbox 1-man Easily Lifts: " . $_POST['field_93'] . "  <br />
Ladder: " . $_POST['field_95'] . "  <br />
Lawnmower/ Push mower: " . $_POST['field_96'] . "  <br />
Yard Tools: " . $_POST['field_97'] . "  <br />
Metal Shelves or Plastic Shelves: " . $_POST['field_94'] . "  <br />
Bicycles: " . $_POST['field_99'] . "  <br />
Patio Table: " . $_POST['field_100'] . "  <br />
Patio Chairs: " . $_POST['field_101'] . "  <br />
Glider: " . $_POST['field_102'] . "  <br />
BBQ or Gas Grill: " . $_POST['field_103'] . "  <br /><br />

Miscellaneous   <br /><br />

Box, Bag, Tote under 50 lbs.: " . $_POST['field_76'] . "  <br />
Box, Bag, Tote over 50 lbs.: " . $_POST['field_77'] . "  <br />
Glass Top-Small: " . $_POST['field_78'] . "  <br />
Glass Top-Large: " . $_POST['field_79'] . "  <br />
Glass Shelves: " . $_POST['field_80'] . "  <br />
Lamps, Table, Floor: " . $_POST['field_81'] . "  <br />
Pictures, Artwork: " . $_POST['field_82'] . "  <br />
Plants-Medium: " . $_POST['field_83'] . "  <br />
Plants-Large: " . $_POST['field_84'] . "  <br />
Fan: " . $_POST['field_86'] . "  <br />
Trash Can: " . $_POST['field_87'] . "  <br />
Luggage, Suitcases: " . $_POST['field_88'] . "  <br />
Storage Cabinet: " . $_POST['field_90'] . "   <br /><br />

Other Items not Listed  <br /><br />

Other 1: " . $_POST['field_104'] . "  <br />
Other 2: " . $_POST['field_105'] . "  <br />
Other 3: " . $_POST['field_106'] . "  <br />
Other 4: " . $_POST['field_107'] . "  <br /><br />

Additional Services Requested   <br /><br />

Request In home Estimate: ". $_POST['field_111'] ."  <br />
Disassembly and Assembly Services: ". $_POST['field_108'] ."  <br />
Packing Services: ". $_POST['field_112'] ."  <br />
Packing Materials: ". $_POST['field_113'] ."  <br />
Un-Packing Services: ". $_POST['field_115'] ."  <br />
Extra Pickup, Drop off locations Extra Stops Required: ". $_POST['field_114'] ."   <br /><br />

Free Text Comments  <br /><br />

Comments:   " . $_POST['field_117'] . "  <br /><br />
End of Comments  <br />";

mail($to, $subject, $message, $headers);

$headers  = "MIME-Version: 1.0 \r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1 \r\n";
//$headers .= "From: "[email protected]" \n";
$headers .= "From: [email protected] \n";
$headers .= "Reply To: [email protected] \n";

mail($_POST['field_8'], $subject, $message, $headers);

include("confirm.html");
}
else {
echo "Invalid Captcha String.
  Please hit the back button on your browser and validate each page of the form.
  On the last page of the form re-enter the characters from the displayed graphic.";
}
?>

Answer : How do I modify this php script to send a confirmation?

The form field values are shown twice in your solution: above the Thank you part of the message and after it. I found another solution that works.

If you would like to see it, please let me know and I will post it. Thanks very much.
Random Solutions  
 
programming4us programming4us