I have a HTML (table) order form. Users need to fill in various cells to show the quantity that they would like to order of various items as you can see here: http://angelasmith.com.au/staging/
I have just set up PHPMailer with the default code that they provide and can confirm that I am receiving these emails. I now need to amend their code, so that the emails I receive actually display what information/quantities users have typed into my order form.
Here is an example of what’s in my mail.php file. Currently, I’m receiving emails that read “This is the HTML message body in bold!” as per the Body variable specified. I need to receive the order form containing the information/quantities that users have typed in. I have searched online thoroughly, and can only find examples for email & message, rather than other custom form fields.
$mail->Subject = "New Online Form Enquiry";
$mail->Body = "This is the HTML message body <b>in bold!</b>";
$mail->AltBody = "This is the body in plain text for non-HTML mail clients";
if(!$mail->Send())
{
echo "Message could not be sent. <p>";
echo "Mailer Error: " . $mail->ErrorInfo;
exit;
}
echo "Message has been sent";
?>
Example of a table row in my HTML file. I included this as I believe that I need to be adding a variable of each cell name such as $b15 to retrieve user input, but I’m unsure exactly. I don’t mind if the email I receive is not displayed as a table – I just need to be able to read whatever a user has entered into the form.
<tr>
<td rowspan="2" align="right" class="leftColText"><strong>10 RE</strong></td>
<td height="28"><input name="b15" type="text" class="tdcenter" id="b15" value="1200" style="width:100%;"/></td>
<td><input name="c15" type="text" id="c15" style="width:100%;" onchange="javascript:calcupptbl(15,1.2,5)"/></td>
<td><input name="d15" type="text" id="d15" style="width:100%;" onchange="javascript:calcupptbl(15,1.2,5)"/></td>
<td><input name="e15" type="text" id="e15" style="width:100%;" onchange="javascript:calcupptbl(15,1.2,5)"/></td>
<td><input name="f15" type="text" id="f15" style="width:100%;" onchange="javascript:calcupptbl(15,1.2,5)"/></td>
<td><input name="h15" type="text" id="h15" style="width:100%;"onchange="javascript:calcupptbl(15,1.2,5)"/></td>
<td><input name="i15" type="text" id="i15" style="width:100%;" onchange="javascript:calcupptbl(15,1.2,5)"/></td>
<td><input name="j15" type="text" id="j15" style="width:100%;" onchange="javascript:calcupptbl(15,1.2,5)"/></td>
<td><input name="k15" type="text" id="k15" style="width:100%;" onchange="javascript:calcupptbl(15,1.2,5)"/></td>
<td><input name="l15" type="text" class= "tdcenter" id="l15" value="0.00" style="width:100%;"/></td>
<td><input name="m15" type="text" class="tdcenter" id="m15" value="0" style="width:90%;" onchange="javascript:calcupptbl(15,1.2)"/></td>
</tr>
Ok… so, if I understand clearly, once a customer clicks on “Submit Order”, your script that sends mail is called with a post method. So you you have to retrieve submitted values. So on the top of your script you do this, for example:
Now… once you have retrieved, sanitized and checked all of your values, you insert them into your mail body:
Every $_POST value correspond to an input id of your form.