PDA

View Full Version : Did I Do It Right


TeamLupeRealEstate
10-29-2010, 07:41 PM
so the 2 new websites that i have for my job are done, all i have to do is get the contact forms done. i have watched like 5 tutorials, and i now have a decent understanding of the php language now, its sorta like action script. I know that the page has to be live in order for me to test it. Im currently testing my site on a free hosting service who says they support php. I have uploaded the files and tested the form but nothing happeneds. I was hopeing somebody could help me, or at least look at my code and tell me if im heading in the right direction. Any advice would be helpful. thanks

<?php
/* Email and subject varibles*/
$emailSubject = 'New Lead From Web Site!';
$webMaster = 'Marketing@HOTXhomes.com';

/* Gathering form info varialbes */
$emailField = $_POST['Email'];
$firstNameField = $_POST['FirstName'];
$lastNameField = $_POST['LastName'];
$phoneField = $_POST['Phone'];
$addressField = $_POST['Contact'];
$commentsField = $_POST['comments'];

$body = <<<EOD
<br><hr><br>
Email: $emailField <br>
First Name: $firstNameField <br>
Last Name: $lastNameField <br>
Phone Number: $phoneField <br>
Address: $addressField <br>
Comments: $commentsField <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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Thank You</title>
<style type="text/css">
.size {
font-size: 36px;
}
</style>
</head>
<body bgcolor="#D4B877" class="size">
Thank you for contacting us. Your information has been sent and you will be contacted as soon as possible.
</body>
</html>
EOD;
echo "theResults";
?>

edbr
10-30-2010, 01:25 AM
many problems with this form , as you will find if you do a yahoogle search.
in the body add
<?php
echo $_POST['Email']."<br />";
echo $_POST['FirstName']."<br />";
echo $_POST['LastName'."<br />"];
echo $_POST['Phone']."<br />";
echo $_POST['Contact']."<br />";
echo $_POST['comments']."<br />";
?>

this will show if your $_POST 's are being passed to your script

davidj
10-30-2010, 12:28 PM
install WAMPSERVER (http://www.wampserver.com/en/)

It will allow you to test locally

addition....

Oh.. relised you are testing email functionality... Ignor me