I am having a problem getting my php email script to retrieve variables from the email form. The email sends properly, however, it is blank. I've used this same email script before with not problems so I don't know what is going on. Also, whenever the email arrives, it outputs twice, like this:
Sender:
Company:
Sender:
Company:
Sender:
Company:
Sender:
Company:
PHP Code:
<fieldset id="loginMenu">
<form action="index.php" method="post">
<fieldset id="formLeft">
<select name="recipient">
<option value="">Choose a recipient</option>
<option value="recipient_1">Person One</option>
<option value="recipient_2">Person Two</option>
<option value="recipient_3">Person Three</option>
</select>
<label>Name</label>
<input type="text" id="name" name="name" value="" />
<label>Company</label>
<input type="text" id="company" name="company" value="" />
<label>Email</label>
<input type="text" id="email" name="email" value="" />
</fieldset>
<fieldset id="formRight">
<label>Message</label>
<textarea id="comment" name="comment"></textarea>
<input type="image" class="btn" value="Send Message" />
</fieldset>
</form>
</fieldset>
<?php
if (isset($_POST['email'])) {
$subject = "Contact Form";
$email = $_REQUEST['email'] ;
$comment = $_REQUEST['comment'] ;
$message = "$message";
$headers = "From: $name";
$recipients = array(
'recipient_1' => '[email protected]',
'recipient_2' => '[email protected]',
'recipient_3' => '[email protected]'
);
$to = $recipients[$_REQUEST['recipient']];
mail($to, $subject, $message, $headers) ;
if($sent)
{print "Your mail was sent successfully"; }
else
{print "We encountered an error sending your mail"; }
}
?>
Comment