Im having trouble Im new to PHP but Im familiar with Classic ASP which is very similar minus a few $ signs etc.
I have this PHP mailer code and for some reason it is mailing but its mailing blank. I have tried to keep the sendmail.php short until is working so Im not sending all fields until I know it works for less errors simplicity FYI
I have included entire pages code so that maybe I have overlooked something.
Can someone please help me fix this code so it sends the data in the email. I have tried avery aspect I can find in the last 4 hours and IM at a lost on it.
Thanks in advance.
Contact Form:
Contact-us.html
[php]
Contact Us | Affordable Fence Guys<link rel="stylesheet" href="css/bootstrap.min.css">
<link rel="stylesheet" href="css/bootstrap-responsive.min.css">
<link rel="stylesheet" href="css/font-awesome.min.css">
<link rel="stylesheet" href="css/main.css">
<link rel="stylesheet" href="css/sl-slide.css">
<script src="js/vendor/modernizr-2.6.2-respond-1.1.0.min.js"></script>
<!-- Le fav and touch icons -->
<link rel="shortcut icon" href="images/ico/favicon.ico">
<link rel="apple-touch-icon-precomposed" sizes="144x144" href="images/ico/apple-touch-icon-144-precomposed.png">
<link rel="apple-touch-icon-precomposed" sizes="114x114" href="images/ico/apple-touch-icon-114-precomposed.png">
<link rel="apple-touch-icon-precomposed" sizes="72x72" href="images/ico/apple-touch-icon-72-precomposed.png">
<link rel="apple-touch-icon-precomposed" href="images/ico/apple-touch-icon-57-precomposed.png">
<!--Header-->
<header class="navbar navbar-fixed-top">
<div class="navbar-inner">
<div class="container">
<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
<a id="logo" class="pull-left" href="index.html"></a>
<div class="nav-collapse collapse pull-right">
<ul class="nav">
<li><a href="index.html">Home</a></li>
<li><a href="about-us.html">About Us</a></li>
<li><a href="services.html">Services</a></li>
<li><a href="portfolio.html">Portfolio</a></li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Pages <i class="icon-angle-down"></i></a>
<ul class="dropdown-menu">
<li><a href="career.html">Career</a></li>
<li><a href="blog-item.html">Blog Single</a></li>
<li><a href="faq.html">FAQ</a></li>
<li><a href="pricing.html">Pricing</a></li>
<li><a href="404.html">404</a></li>
<li><a href="typography.html">Typography</a></li>
<li><a href="registration.html">Registration</a></li>
<li class="divider"></li>
<li><a href="privacy.html">Privacy Policy</a></li>
<li><a href="terms.html">Terms of Use</a></li>
</ul>
</li>
<li><a href="blog.html">Blog</a></li>
<li class="active"><a href="contact-us.html">Contact</a></li>
<li class="login">
<a data-toggle="modal" href="#loginForm"><i class="icon-lock"></i></a>
</li>
</ul>
</div><!--/.nav-collapse -->
</div>
</div>
</header>
<!-- /header -->
<section id="contact-page" class="container">
<div class="row-fluid">
<div class="span8">
<h4>Contact Form</h4>
<div class="status alert alert-success" style="display: none"></div>
<form id="main-contact-form" class="contact-form" name="contact-form" method="post" action="sendemail.php">
<div class="row-fluid">
<div class="span5">
<label>First Name</label>
<input type="text" class="input-block-level" required="required" placeholder="Your First Name">
<label>Last Name</label>
<input type="text" class="input-block-level" required="required" placeholder="Your Last Name">
<label>Phone</label>
<input type="text" class="input-block-level" required="required" placeholder="Your Phone Number">
<label>Email Address</label>
<input type="text" class="input-block-level" required="required" placeholder="Your Email Address">
</div>
<div class="span6">
<label>Address</label>
<input type="text" class="input-block-level" required="required" placeholder="Your Address">
<label>City</label>
<input type="text" class="input-block-level" required="required" placeholder="Your City">
<label>State</label>
<input type="text" class="input-block-level" required="required" placeholder="Your State">
<label>Zip</label>
<input type="text" class="input-block-level" required="required" placeholder="Your Zip">
</div>
<div class="span7">
<label>Message</label>
<textarea name="message" id="message" required="required" class="input-block-level" rows="8"></textarea>
</div>
</div>
<button type="submit" class="btn btn-primary btn-large pull-right">Send Message</button>
<p> </p>
</form>
</div>
</section>
<!--row-fluids-->
<div class="row-fluid">
<!--Contact Form-->
<div class="span3">
<h4>Affordable Fence Guys Phone Nubmer</h4>
<ul class="unstyled address">
<li>
<i class="icon-phone"></i>
<strong>Contact Us Today For a Free Estimate:</strong> 803-374-7373
</li>
</ul>
</div>
<!--End Contact Form-->
</div>
</div>
<!--/row-fluid-->
<div class="span6">
<ul class="social pull-right">
<li><a href="https://www.facebook.com/affordablefenceguys/"><i class="icon-facebook"></i></a></li>
</ul>
</div>
<div class="span1">
<a id="gototop" class="gototop pull-right" href="#"><i class="icon-angle-up"></i></a>
</div>
<!--/Goto Top-->
</div>
</div>
Login Form
[/php]
Sendmail.php
[php]
<?php header('Content-type: application/json'); $status = array( 'type'=>'success', 'message'=>'Email sent!' ); $fname = @trim(stripslashes($_POST['First name'])); $email = @trim(stripslashes($_POST['email'])); $message = @trim(stripslashes($_POST['message'])); $email_from = $email; $email_to = '[email protected]'; $body = 'Name: ' . $fname . "\n\n" . 'Email: ' . $email . "\n\n" . 'Message: ' . $message; $success = @mail($email_to, $body, 'From: <'.$email_from.'>'); echo json_encode($status); die; [/php]