I haven't tested it but this should work:
PHP Code:
<?php
if (isset($_POST['Submit'])) {
$name = htmlentities($_POST['name']); $phone = htmlentities($_POST['phone']); $email = htmlentities($_POST['email']); $make_appt = htmlentities($_POST['make_appt']); $donor_app = htmlentities($_POST['donor_app']); $have_comment = htmlentities($_POST['have_comment']); $comment = htmlentities($_POST['comment']);
$to = 'recieversemailaddress@somedomain.com'; $subject = 'You\'ve got mail!'; $message =
<<<heredoc
You have recieved the following email: \n\n
Name: $name \n Phone: $phone \n Email: $email \n Why: {$make_appt}{$donor_app}{$have_comment}\n Comment: $comment
heredoc;
$sendMail = mail($to, $subject, $message);
echo ($sendMail) ? 'Message Sent' : 'Message could not be sent';
}
?>
HTML Code:
<form name="form1" method="post" action="">
<p align="left">
<span class="style5">Name</span>
<input name="name" type="text" size="25">
</p>
<p align="left">
<span class="style5">Phone</span>
<input name="phone" type="text" size="25">
</p>
<p align="left">
<span class="style5">Email</span>
<input name="email" type="text" size="25">
</p>
<p class="style5">Please select one </p>
<p>
<span class="style5">Make an appointment</span>
<input name="make_appt" type="radio" value="make appointment">
<span class="style5">Egg Donor application</span>
<input name="donor_app" type="radio" value="egg donor application">
<span class="style5">Have a comment</span>
<input name="have_comment" type="radio" value="have comment">
</p>
<p align="left"> </p>
<p align="center" class="style5">Comment</p>
<p>
<textarea name="comment" cols="40" rows="10"></textarea>
</p>
<p>
<input type="submit" name="Submit" value="Submit">
</p>
</form>
As you can see I changed your form a bit, 1st try to use relevant names for your form fields. Don't name a radio button "radio button" name it "egg donor application" for example. Also each field name must be unique, in your original form you had multiple radio buttons with the same name.
Last edited by Marik; 03-03-2011 at 08:50 PM..
|