I am not getting emails from php form

I used a template that supposedly had a working php form, but I am not getting the emails. Any help would be appreciated. I am going to list the code for the html page first then the php page.

[code]

Contact Martin Met Supply | 770-418-0506 @import "style/style.css";

Skip over navigation

Martin Met Supply Header

		<div id="placemainmenu">
			<ul id="mainmenu">
				<li><a href="index.html">Home</a></li>
				<li><a href="aboutus.html">About Us</a></li>
				
				<li><a href="services.html">Our Services</a></li>
									<li><a href="#">Products</a>
                						<ul>
						<li><a href="testers.html">Testers</a></li>
                        							<li><a href="testblocks.html">Test Blocks</a></li>
                                                    <li><a href="durometers.html">Durometers</a></li>
					</ul>
                    </li>
				<li><a href="contactus.html">Contact Us</a></li>
				
			</ul>
		</div>
       </div> 
	</div>
    <div class="clear"></div>
	<div id="content">
	<div id="fullwidth">
			<h1>Contact Us</h1>
			<p> 	

We can be contacted via e-mail, phone, fax or mail.

Mailing Address:

Martin Metallurgical Supply Inc.

P.O. Box 2614

Duluth, Georgia 30096 USA

E-mail:

Sales Inquiries: [email protected]

Service Inquiries: [email protected]

Phone: (770) 418-0506 | Fax: (770) 418-0855

Please feel free to fill out the form below so that we may contact you back as soon as possible.

Your Name: *
Email Address: *
Phone:
				<label for="txtmessage">Message:</label> <textarea cols="50" rows="10" name="message" id="txtmessage" class="textareacontact"></textarea><br />
				<label></label><input type="submit" name="submitcontact" value="Send Message" class="submitcontact" />
			</div>
			</form>
		</div>	
        			
	</div>
	<div id="footer">
		<div id="footerbottom">
			<ul id="menufooter">
				<li class="first">Copyright 2002 - 2012 Martin Metallurgical Supply Inc. • • Website Design by <a href="http://www.artthousigns.com/" target="_blank">Art Thou Signs</a></li>
				<li><a href="index.html">Home</a></li>
				<li><a href="aboutus.html">About Us</a></li>
				<li><a href="contactus.html">Contact Us</a></li>
				<li><a href="privacy.html">Privacy Policy</a></li>
			</ul>
			<ul id="menunetwork">
				<li><a href="#" class="replace" id="menufacebook"><span></span>Facebook</a></li>

				<li><a href="#" class="replace" id="menutwitter"><span></span>Twitter</a></li>

				<li><a href="http://www.linkedin.com/pub/jeff-martin/1a/475/874" class="replace" id="menulinkedin"><span></span>Linkedin</a></li>
			</ul>
		</div>
	</div>
</div>
[/code]

[php]<?php
$name=$_POST[“name”];
$email=$_POST[“email”];
$phone=$_POST[“phone”];
$message=$_POST[“message”];
$submitcontact=$_POST[“submitcontact”];
?>

Contact Martin Met Supply | 770-418-0506 @import "style/style.css";

Skip over navigation

Martin Met Supply Header

		<div id="placemainmenu">
			<ul id="mainmenu">
				<li><a href="index.html">Home</a></li>
				<li><a href="aboutus.html">About Us</a></li>
				
				<li><a href="services.html">Our Services</a></li>
									<li><a href="#">Products</a>
                						<ul>
						<li><a href="testers.html">Testers</a></li>
                        							<li><a href="testblocks.html">Test Blocks</a></li>
                                                    <li><a href="durometers.html">Durometers</a></li>
					</ul>
                    </li>
				<li><a href="contactus.html">Contact Us</a></li>
				
			</ul>
		</div>
       </div> 
	</div>
    <div class="clear"></div>
	<div id="content">
	<div id="fullwidth">
			<h1>Contact Us</h1>
			<p> 	

We can be contacted via e-mail, phone, fax or mail.

Mailing Address:

Martin Metallurgical Supply Inc.

P.O. Box 2614

Duluth, Georgia 30096 USA

E-mail:

Sales Inquiries: [email protected]

Service Inquiries: [email protected]

Phone: (770) 418-0506 | Fax: (770) 418-0855

Please feel free to fill out the form below so that we may contact you back as soon as possible.

			<?php
			if ($submitcontact) {
				$error=0;
				if ($name=="") {
					echo "<div class=\"errordiv\">Please type your name.</div>";
					$error=1;
				}
				if ($email=="") {
					echo "<div class=\"errordiv\">Please type your email address.</div>";
					$error=1;
				} else if (!preg_match("/^([a-zA-Z0-9])+([a-zA-Z0-9\._-])*@([a-zA-Z0-9_-])+([a-zA-Z0-9\._-]+)+$/",$email)) {
					echo "<div class=\"errordiv\">Please type valid email address.</div>";
					$error=1;
				}
				if ($message=="") {
					echo "<div class=\"errordiv\">Type your message.</div>";
					$error=1;
				} 
				if ($error==0) {
					$myemail="[email protected]"; // 
					$to=$myemail;
					$subject="[Contact Us] $name";
					$header="from: $name <$email>\n";
					$header.="MIME-Version: 1.0";
					$message2="$name $phone \r\n\r\n";
					$message2.="$message \r\n\r\n";
					$sentmail = mail($to,$subject,$message2,$header);
					if ($sentmail) {
						echo "<div class=\"correctdiv\">Thank you for your message, we will reply your message as soon as possible</div>";
						$name="";
						$email="";
						$phone="";
						$message2="";
					}
				}
			}
			?>                
			<form method="post" action="#" id="frmcontact">
			<div>
				<label for="txtname">Your Name:</label>
				<input type="text" name="name" class="textboxcontact" id="txtname" value="<?=$name?>" />
      <span>*</span><br />
				<label for="txtemail">Email Address:</label>
				<input type="text" name="email" class="textboxcontact" id="txtemail" value="<?=$email?>" />
        <span>*</span><br />
                <label for="txtphone">Phone:</label>
                <input type="text" name="phone" class="textboxcontact" id="txtphone" value="<?=$phone?>" />
          <br />
                
				<label for="txtmessage">Message:</label>
			  <textarea cols="50" rows="10" name="message" id="txtmessage" class="textareacontact"><?=$message?>
				</textarea>
		    <br />
				<label></label>
				<input type="submit" name="submitcontact" value="Send Message" class="submitcontact" />
			</div>
			</form>
		</div>	
        			
	</div>
	<div id="footer">
		<div id="footerbottom">
			<ul id="menufooter">
				<li class="first">Copyright 2002 - 2012 Martin Metallurgical Supply Inc. • • Website Design by <a href="http://www.artthousigns.com/" target="_blank">Art Thou Signs</a></li>
				<li><a href="index.html">Home</a></li>
				<li><a href="aboutus.html">About Us</a></li>
				<li><a href="#">Contact Us</a></li>
				<li><a href="#">Privacy Policy</a></li>
			</ul>
			<ul id="menunetwork">
				<li><a href="#" class="replace" id="menufacebook"><span></span>Facebook</a></li>

				<li><a href="#" class="replace" id="menutwitter"><span></span>Twitter</a></li>

[/php]

Try changing your form action to this:

[php]

[/php]

Still doesn’t appear to be working. Any other ideas?

What is happening? Is the form submitting? Are you getting any errors?

When I hit the submit button, the input areas go blank like something happened, but the email is not showing up on the server.

Sounds like a javascript problem. If you can put the page online and give me a URL I will take a closer look.

Here is the link to the page:
http://martinmetsupply.com/contactus.html

I noticed you are using a .html file. Is your server configured to parse PHP in *.html?

Try changing contactus.html to contactus.php and see if anything changes.

I have one file that ends in html and another file with exactly the same thing with the php added that ends with php. Do I only need the php file?

Yes you only need the PHP one

That was it. Thank you so much. On another site I made, I had an html file and two separate php pages with just the php code.

Sponsor our Newsletter | Privacy Policy | Terms of Service