Log in

View Full Version : Contact form: how to make it works?



shirleymikan
07-30-2012, 04:14 PM
Hello everyone,

http://playground.mobily.pl/assets/files/tutorials/form/awesomeform.zip
I find this contact form is very nice.
But I don't know how to make it works.

Because there is no php file.
I don't know where to set the email address
which users can submit to.

Could anyone help me...?

Thank you!!!

rickybacker60
08-05-2012, 12:02 PM
Hi Shirley
I looked at this form and here's a simple php page that should work.

First the form needs to be directed to the php file with the full address of your site (I called it mailsent.php)



<form id="form" class="blocks" action="http://YOUR WEBSITE ADDRESS/mailsent.php" method="post">


Now the code for the page "mailsent.php" is below:


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<h1>Email Result</h1>
<?php // get form data
$email=$_POST['email'];
$name=$_POST['name'] . "-" . $_POST['company'] . "-" . $_POST['phone'];
$subject="YOUR SITE NAME - WEBSITE ENQUIRY"; // enter your website domain name here
$message="SENDER:- " . $name . " MESSAGE:- " . $_POST['Comments'];
$to = "ENTER YOUR EMAIL ADDRESS HERE"; // this is where your email address goes
$headers = "From: $email";
$sent = mail($to, $subject, $message, $headers) ; // sending email
if($sent) //successfully sent
{
?>
<table width="500" border="0" align="center" cellpadding="1" cellspacing="0">
<tr>
<td align="left" valign="top" bgcolor="#ccc"> <table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="center" bgcolor="#ccc"> <p>&nbsp;</p>
<p>Thankyou. Your Email Has Been Sent</p>
<p>Please <a href="ENTER REFERRAL PAGE HERE">click
here </a> &nbsp;to continue</p>
<p>&nbsp;</p></td>
</tr>
</table></td>
</tr>
</table>
<? } //end if
else // unsuccessfully sent
{
?>
<p>&nbsp;</p><table width="500" border="0" align="center" cellpadding="1" cellspacing="0">
<tr>
<td align="left" valign="top" bgcolor="#ccc"> <table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="center" bgcolor="#ccc"> <p>&nbsp;</p>
<p>Sorry , An Error Was Encountered </p>
<p>Please <a href="ENTER REFERRAL PAGE HERE">click
here</a>&nbsp;to continue</p>
<p>&nbsp;</p></td>
</tr>
</table></td>
</tr>
</table>
<? } //end else
?>
</body>
</html>


I hope this helps.