Jump to content

PHP Contact Form


j05hr

Recommended Posts

I have a contact form and it works perfectly fine. I added the exact same form to a different site and when the page redirect is meant to take you to a thank you page, the error message from my php form comes up, but still sends the message?  Would anyone know what is causing this problem?  The hosting it doesn't work on is with 1&1

 

I deleted the email address out and the forwarding page so you can't search it on google

 

<body>
<?php 

// Check for form submission:
if (isset($_POST['submitted'])) {

// Minimal form validation:
if (!empty($_POST['name']) && !empty($_POST['business']) && !empty($_POST['tel']) && !empty($_POST['email']) ) {

	// Create the body:
	$body = "Name: {$_POST['name']} \n\nBusiness: {$_POST['business']} \n\nTel: {$_POST['tel']} ";

	// Make it no longer than 70 characters long:
	$body = wordwrap($body, 70);

	// Send the email:
	mail('', 'Contact Form Submission', $body, "From: {$_POST['email']}");

	// Print a message:
	$success = mail($to, $subject, $body);
	}
	if ($success){
	header("location: http://");



	// Clear $_POST (so that the form's not sticky):
	$_POST = array();

} else {
	$message = '<p style="font-weight: bold; color: #C00">Please fill out the form completely.</p>';

}

} // End of main isset() IF.

// Create the HTML form:
?>
<div id="wrapper">
<div id="header">
<div id="headerImages"> <img src="images/image1.gif" alt="image1"/> <img src="images/image2.gif" alt="image2"/> <img src="images/image3.gif" alt="image3"/> </div>
<div id="nav">
<ul>
<li class="home"><a href="index.html">Home</a></li>
<li class="services"><a href="services.html">Services</a></li>
<li class="about"><a href="about.html">About</a></li>
<li class="products"><a href="products.html">Products</a></li>
<li class="contactActive"><a href="contact.php">Contact</a></li>
<li class="request"><a href="request.php">Request</a></li>
</ul>
</div>
</div>
<div id="background">
<div id="container">
<div id="requestACall">
<div id="requestCallForm"><h2 class="requestCall">REQUEST CALL-BACK</h2>
<br /> 
<?php if (!empty($message)) {
        echo "<p class=\"messge\">" . $message . "</p>";
        } ?>
<form action="contact.php" method="post"  />
<h3 class="requestCall">NAME</h3>
<input type="text" name="name" id="name" value="<?php if (isset($_POST['name'])) echo $_POST['name']; ?>" />
<h3 class="requestCall">BUSINESS</h3>
<input type="text" name="business" id="business" value="<?php if (isset($_POST['business'])) echo $_POST['business']; ?>" />
<h3 class="requestCall">TEL</h3>
<input type="text" name="tel" id="tel" value="<?php if (isset($_POST['tel'])) echo $_POST['tel']; ?>" />
<h3 class="requestCall">EMAIL</h3>
<input type="text" name="email" id="email" value="<?php if (isset($_POST['email'])) echo $_POST['email']; ?>" />
<p class="submit"><input type="submit" name="submitted" value="" /></p>
</div>
		</div>	
			</div>
<div id="footer1">
<a href="index.html">HOME</a> | <a href="services.html">SERVICES</a> | <a href="about.html">ABOUT</a> | <a href="products.html">PRODUCTS</a> | <a href="contact.php">CONTACT</a> | <a href="terms.html">TERMS</a> | <a href="request.php">QUOTES</a> </div>
</div>
<div id="footer">
</div>
</div>
</body>
</html>

 

Thanks,

Josh

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.