I have this as a file called: sendform.php:
<?php
if($_POST[“job_title”]) {
mail(“[email protected]”, “THIS is the subject line”,
$_POST[“job_title”]. “\nsome text here”);
}
?>
The following page ‘contact.php’ is successful in sending an email to ‘[email protected]’ containing the contents of field ‘job_title’ and (on a new line) the words ‘some text here’.
What I need is a version of sendform.php which includes in the email body:
– every formfield in contact.php
– each one preceded by the name of the field (eg ‘job_title: HEAD OF OPS’ where HEAD OF OPS is what the user has typed into that field.
<form method="post" action="sendform.php">
<div class="w3-container pnc-label"><label for="job_title"><b>JOB TITLE:</b></label><br>
<input style="margin-left:1em;background: #fff;padding-left:.4em;" type="text" id="job_title" name="job_title" placeholder="click and type here the JOB TITLE...this message will then disappear">
</div>
<div class="w3-container pnc-label"><label for="employer_name"><b>Employer Name:</b></label><br>
<input style="margin-left:1em;background: #fff;padding-left:.4em;" type="text" id="employer_name" name="employer_name" placeholder="Name of Employing Organisation...">
</div>
<div class="w3-container pnc-label"><label for="employment_location"><b>Location of Employment:</b></label><br>
<input style="margin-left:1em;background: #fff;padding-left:.4em;" type="text" id="employment_location" name="employment_location" placeholder="(optional) Location of employment...">
</div>
<div><label>Message:</label><br>
<textarea rows="5" cols="20" name="message"></textarea>
</div>
<div class="w3-center">
<button type="submit"
class="w3-teal w3-hover-green
w3-round w3-button">
SUBMIT
</button>
</div>
</form>