Everything seems to be working fine, but I cant figure out how to get the emails to come from the senders email address. Can anyone help me out on this?
Thanks in advance!
<?php
if(isset($_POST['submit'])) {
$from = "Volunteer Submission";
$to = "adam@email.com";
$subject = "Volunteer Submission";
$name_field = $_POST['name'];
$email_field = $_POST['email'];
$phone_field = $_POST['phone'];
foreach($_POST['check'] as $value) {
$check_msg .= "Volunteer for: $value
";
}
$body = "From: $name_field
E-Mail: $email_field
Phone: $phone_field
$check_msg";
mail($to, $subject, $body, $from);
}
?>
<form method="post" action="volunteer.php" name="contact" id="contact" onSubmit="return validate()">
<br />
<table border="0" align="center" cellpadding="2" cellspacing="0">
<tr>
<td width="38"><strong>Name: </strong></td>
<td width="257"><input type="text" name="name" size="19" /></td>
</tr>
<tr>
<td><strong>E-Mail: </strong></td>
<td><input type="text" name="email" size="19" /></td>
</tr>
<tr>
<td><strong>Phone:</strong></td>
<td><input name="phone" type="text" id="phone" size="19" /></td>
</tr>
<tr>
<td colspan="2"><strong>I would like to volunteer for: </strong></td>
</tr>
<tr>
<td colspan="2"><table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><input type="checkbox" name="check[]" value="parking" />
Parking<br />
<input type="checkbox" name="check[]" value="greeters" />
Greeters<br />
<input type="checkbox" name="check[]" value="ushers" />
Ushers<br />
<input type="checkbox" name="check[]" value="guestservices" />
Guest Services/Information<br />
<input type="checkbox" name="check[]" value="hospitalityteam" />
Hospitality Team</td>
<td width="10"> </td>
<td><input type="checkbox" name="check[]" value="newbeliever" />
New Believer Follow-Up<br />
<input type="checkbox" name="check[]" value="baptism" />
Baptism <br />
<input type="checkbox" name="check[]" value="couples" />
Couples<br />
<input type="checkbox" name="check[]" value="womens" />
Womens<br />
<input type="checkbox" name="check[]" value="mens" />
Mens</td>
</tr>
</table>
</td>
</tr>
<tr>
<td> </td>
<td><br />
<input type="submit" value="Submit" name="submit"/></td></tr>
</table>
</form>