Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Contact Form help

New Here ,
Jul 16, 2008 Jul 16, 2008
When I test my contact form at my webpage, instead of sending the email, it redirects to the php form I'm using when I click the "send" button. For the properties, I have it set as this for the form: "Action:ESFContactForm.php, Method:POST."

Here's my php code...I changed some info to keep things private for my client:

<?php

/* Subject and Email variables */

$emailSubject = '';
$webMaster = 'name@site.com';

/* Gathering Date Variables */

$nameField = $_POST['name'];
$biznameField = $_POST['bizname'];
$addressField = $_POST['address'];
$cityField = $_POST['city'];
$stateField = $_POST['state'];
$zipcodeField = $_POST['zipcode'];
$phoneField = $_POST['phone'];
$emailField = $_POST['email'];
$commentsField = $_POST['comments'];

$body = <<<EOD
<br><hr><br>
Your Name: $name <br>
Business Name: $bizname <br>
Street Address: $address <br>
City: $city <br>
State: $state <br>
Zip: $zipcode <br>
Phone: $phone <br>
Email: $email <br>
Comments: $comments <br>

EOD;

$headers = "From: $email\r\n";
$headers .= "Content-type: text/html\r\n";
$success = mail($webMaster, $emailSubject, $body, $headers);

/* Results rendered as HTML */

$theResults = <<<EOD
<html>
<head>
<title>Titled Added Here</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
body {
background-color: #BCBCBC;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 12px;
font-style: normal;
line-height: normal;
font-weight: normal;
color: #000000;
text-decoration: none;
}
-->
</style>
</head>

<div>
<div align="left">Thank you for your interest! Your email will be answered very soon!</div>
</div>
</body>
</html>
EOD;
echo "$theResults";


?>
TOPICS
Server side applications
436
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jul 16, 2008 Jul 16, 2008
Add-on...when I click the submit button, it tries to read the php page as if it was a page such as html, then gives me a "cannot find this page" error message. I have the submit button in a form box with the PHP file name in the "Action."
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jul 16, 2008 Jul 16, 2008
Another add...someone mentioned I need a "database" as told by PHPesp - what is that?
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jul 17, 2008 Jul 17, 2008
You do not need a database for this. You need the form to be set to process itself, and then you need to put a header command in once the mail sends with a redirect in it.

they are formatted like this:

header("Location: [url goes here]");

Make sure this is AFTER your mail script, and wrapped in an if statement that only processes it if your mail is sent.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jul 17, 2008 Jul 17, 2008
LATEST
Could you help me a little more on this please?
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines