How to Make a Simple Feedback Form using HTML

September 4th, 2009

Steps to making a feedback form on your website where people can email you information.

1. Copy the below code

2. Replace the following:
a. FormMail Demo: With your page title.
b. www.mydomain.com: With your domain name.
c. youremail@here.com: With your website email address.

3. Replace the words in with whatever you want that part of the form to say.
a. Whatever you want to say here
b. Visitor E-Mail
c. E-Mail Content
d. E-Mail Me!

4. Save it as a .html (e.g form.html)

5. Upload and you are done.

Note: Make sure you use an email address on the server as you can’t use an outside email address for security reasons. You can always use a forwarder to send it to an outside email address as well.

Form script without any validation:

<html>
<head>
<title>FormMail Demo</title>
</head>
<body>
<form action="http://www.mydomain.com/formmail.php" method="post">
<input type="hidden" name="recipient" value="youremail@here.com">
<input type="hidden" name="subject" value="FormMail E-Mail">
Whatever you want to say here<br /><br />
<input type="text" name="email" size="20" value="Visitor E-Mail"><br />
<input type="text" name="tellme" size="20" value="E-Mail Content"><br /><br />
<input type="submit" name="submit" value="E-Mail Me!">
<input type="hidden" name="redirect" value="http://yourdomain.com/redirecto.html">
</form>
</body>
</html>

The PHP Code for the form:

<?php?
// Contact
subject?$subject ="subject";
// Details
$message="tellme";
// Mail of sender
$mail_from="email";
// From
$header="<email>";
// Enter your email address
$to ='yourmail@here.com';
$send_contact=mail($to,subject,tellme);
// Check, if message sent to your email
// display message "We've recived your information"
if($send_contact){?
echo "We've recived your contact information";?} else {?echo "ERROR";?}
?>

Form with Javascript validation:

<html>
<head>
<title>FormMail Demo</title>
<script type="text/javascript">
function hgcheck(thisform)
{
with (thisform)
 {
 if (hgrequired(email,"Visitor E-Mail required!")==false){
   email.focus();
   return false;
   }
 if (hgrequired(tellme,"E-Mail Content required!")==false){
   email.focus();
   return false;
   }
 }
}
function hgrequired(newfield,newmessage)
{
with (newfield)
 {
 if (value)
   return true;
 else
   {
   alert(newmessage);
   return false;
   }
 }
}
</script>
</head>
<body>
<form action="http://www.mydomain.com/cgi-sys/formmail.pl" method="post" onsubmit="return hgcheck(this)">
<input type="hidden" name="recipient" value="youremail@here.com">
<input type="hidden" name="subject" value="FormMail E-Mail">
Whatever you want to say here<br /><br />
Visitor E-Mail: <input type="text" name="email" size="20" value=""><br />
E-Mail Content: <input type="text" name="tellme" size="20" value=""><br /><br />
<input type="submit" name="submit" value="E-Mail Me!">
<input type="hidden" name="redirect" value="http://www.mydomain.com/path">
</form>
</body>
</html>
SocialTwist Tell-a-Friend

Leave A Comment