Alright, I have my form (first snippet of code), and I am trying to use PHPmailer to send it. However, it sends the message without any of the information from the actual form. I am pretty lost with how to get this to work.
<form action="send_form_email.php" method="post" id="ContactForm">
<fieldset>
<p class="email">magazines/newspapers</p>
<ol>
<li>
<label for=name>Name</label>
<input id="name" name="name" type="text" placeholder="name" required autofocus>
</li>
<li>
<label for=email>Email</label>
<input id="email" name="email" type=email placeholder="[email protected]" required>
</li>
<li>
<label for=telephone>Phone</label>
<input id=telephone name=telephone type=tel placeholder="Eg. 888-555-5555" required>
</li>
<li>
<label for="comments">note</label>
<textarea name=comments type=text placeholder="enter your comments" required></textarea>
</li>
<li>
<label for="file">File</label>
<input id="file" type="file" name="file" />
</li>
</ol>
</fieldset>
<fieldset>
<button type=submit>submit</button>
</fieldset>
</form>
Mail Script:
require("mail/class.phpmailer.php");
$mail = new PHPMailer();
$mail->Host = "localhost";
$mail->From = "[email protected]";
$mail->FromName = "Your Name";
$mail->AddAddress("[email protected]");
$mail->Subject = "Feedback form results";
$mail->Body = $comments;
$mail->WordWrap = 50;
if(!$mail->Send())
{
echo 'Message was not sent.';
echo 'Mailer error: ' . $mail->ErrorInfo;
}
else
{
echo 'Thank you for your feedback.';
}
$email = $_REQUEST['email'] ;
$comments = $_POST['telephone'] ;
$phone = $_REQUEST['comments'] ;
$message = $_REQUEST['message'] ;