On my previous post, I was asking regarding email with attachment. It's the first time for me to do one. And to make it simple, I have no idea how to do it. I have done some tutorials and such but it doesn't seem to work.
I have a contact page working, I will write down the information below. It is working but I need to add an attachment
here is the link
http://jsfiddle.net/misaki03/e7mwn93u/
<?php
$to = "prettychii03@gmail.com";
$subject = isset($_POST['subject']) ? $_POST['subject'] : '';
$fname = isset($_POST['fname']) ? $_POST['fname'] : '';
$lname = isset($_POST['lname']) ? $_POST['lname'] : '';
$email = isset($_POST['email']) ? $_POST['email'] : '';
$pnum = isset($_POST['pnum']) ? $_POST['pnum'] : '';
$message = isset($_POST['message']) ? $_POST['message'] : '';
$emailType = isset($_POST['emailType']) ? $_POST['emailType'] : '';
$body = <<<Email
First Name: $fname
Last Name: $lname
Email Address: $email
Phone Number: $pnum
Message:
$message
Thanks,
$lname, $fname
Email;
$header = "From: $email";
$subject2 = $emailType." : ".$subject;
if($_POST){
if($lname == '' || $fname == '' || $email == '' || $pnum == '' || $message == ''){
}else{
mail($to, $subject2, $body, $header);
echo "Thank you for sending us an email! We have recieved your message.";
}
}
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>My title</title>
<link href="style2.css" rel="stylesheet" />
</head>
<body>
<div id="container"> <!--wrapper-->
<header id="header">
<div id="menu" class="menu"> <!--navMenu-->
<ul>
<li><a href="index.php" > HOME </a></li>
<li>OUR PRODUCT
<ul>
<li><a href="productOverview.php" > PRODUCT OVERVIEW</a></li>
<li><a href="usage.php" > CHEESECLOTH USAGE</a></li>
<li><a href="reviews.php" > PRODUCT REVIEWS </a></li>
</ul>
</li>
<li> SUGGESTIONS
<ul>
<li><a href="tips.php" > TIPS and IDEAS </a></li>
<li><a href="recipe.php" > RECIPES </a></li>
<li><a href="ideas.php" > SEND US YOUR IDEAS </a></li>
</ul>
</li>
<li><a href="about.php" > ABOUT US </a> </li>
<li><a href="contact.php" > CONTACT US </a> </li>
</ul>
<br class="clearFloat" />
</div>
</header>
<section id="content">
<div class="about" id="about">
<center>
<h2>- CONTACT US -</h2>
<h4>Got any question or comments for us? Or do you have any suggestion that you would want us to share the world? Give us your thoughts and we might feature your work on our site! Don't hesitate to send us an email using the form below.
<br /><br />
<div id="contactUs">
<form action="?" method="post">
<table style="width:750px; border:0">
<tr>
<td><label for="fname">First Name : </label> </td>
<td><input type="text" name="fname" id="fname" required="required" /> </td>
</tr>
<tr>
<td><label for="lname">Last Name : </label></td>
<td><input type="text" name="lname" id="lname" required="required" /></td>
</tr>
<tr>
<td><label for="email">Email : </label></td>
<td><input type="text" name="email" id="email" required="required" /></td>
</tr>
<tr>
<td><label for="pnum"> Phone Number : </label></td>
<td><input type="text" name="pnum" id="pnum" required="required" /></td>
</tr>
<tr>
<td><label for="emailType">Email Type : </label></td>
<td>
<select name="emailType" required="required">
<option value="Comments">Comments</option>
<option value="Question">Question</option>
<option value="Recipe Suggestion">Recipe Suggestion</option>
<option value="Tips Suggestion">Tips Suggestion</option>
<option value="Other">Other</option>
</select>
</td>
</tr>
<tr>
<td><label for="subject">Subject : </label></td>
<td><input type="text" name="subject" id="subject" required="required" /></td>
</tr>
<tr>
<td><label for="message">Message : </label></td>
<td><textarea id="message" name="message" cols="42" rows="9" required="required"></textarea></td>
</tr>
<tr>
<td colspan="2"><div class="buttonSubmit" id="buttonSubmit">
<input type="submit" value="Submit">
</div></td>
</tr>
</table>
</form>
<h3>Jungle Sales LLC / <br />
7495 W. Azure Dr. Suite 110<br />
Las Vegas, NV 89130</h3>
</div>
</center>
</div>
</section>
<footer id="footer">
<div id="fmenu" class="fmenu">
<p>©2015 copyright | All Rights Reserved</p>
<ul class="social_icons">
<li class="social">
<a href="#" target="_blank">
<img src="images/fb.png" /> </a></li>
<li class="social">
<a href="#" target="_blank">
<img src="images/pin.png" /> </a></li>
<li class="social">
<a href="#" target="_blank">
<img src="images/insta.png" /> </a></li>
</ul>
</footer>
</div>
</div>
</body>
</html>
I have been told to use PHPMailer, how do I add that in my code. one comment here mentioned require code. but not sure what else should I add since it is a different code from what I learned. Sorry and thanks for the help.