Dreamweaver 8 contact us form


I have compiled a simple feedback form for a website in Dreamweaver 8 and am now stuck at the crucial part, making it link and publish comments.

The website will be hosted on a Linux server, I attach the HTML created to make the form, can someone please "hold my hand" in making this form functional?

I am yet to create a confirmation page but will put one in imminently.  I have however placed a URL in the script for completeness.

Many many thanks for any help provided.  I am in a rush to get this form and site off the ground.
<p align="left">We would love you receive your views on our website and enhancements or product ranges that you wish to see included in future updates.</p>
      <p align="left">Please use this form below to send us an e-mail: </p>
      <form id="frmContactUs" name="frmContactUs" method="post" action="">
        <div align="left">
          <table width="500" border="0" cellspacing="0" cellpadding="0">
                <td width="161"><label>
                  <input name="subject" type="hidden" id="subject" value="All About Cakes - Contact Us" />
                  <input name="recipient" type="hidden" id="recipient" value="info@allaboutcakesbilston.co.uk" />
                  <input name="redirect" type="hidden" id="redirect" value="http://www.allaboutcakesbilston.co.uk/contactusconfirm.html" />                
                  Your name: </label></td>
                <td colspan="2"><label>
                  <input name="txtYourName" type="text" id="txtYourName" size="40" />
              <td>Your e-mail address: </td>
                <td colspan="2"><label>
                  <input name="txtYourEmail" type="text" id="txtYourEmail" size="40" />
                <td colspan="2"><label>
                  <textarea name="txtComments" cols="38" rows="5" id="txtComments"></textarea>
                <td width="75"><input type="submit" name="Submit" value="Submit" /></td>
                <td width="264"><input name="ClearForm" type="submit" id="ClearForm" value="Clear Form" /></td>

Open in new window

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Are you gonna use PHP to make it validate and post email? Is your server php enabled?
For actually posting the form to the address, you will need PHP script.

create a PHP page with some content, add link to it to the form's action attribute, and to the beginning, add this code:
  mail($_POST['recipient'], $_POST['subject'], "Name: ".$_POST['txtYourName']. "
Email: ".$_POST['txtYourEmail']."


This code will send an email with user's comment to your email address. It's very simple solution with no protection from spam etc, for it would require much longer answer.
MidlandRAuthor Commented:

Thanks for these comments, yes the server is PHP enabled, I am just finding out now how to create a PHP page as I have already developed the form page from an HTML template that is used across the site.
PMI ACP® Project Management

Prepare for the PMI Agile Certified Practitioner (PMI-ACP)® exam, which formally recognizes your knowledge of agile principles and your skill with agile techniques.

PHP page can be html page, but the suffix is .php, and parts between <? ?> is considered PHP code, that is processed by the engine. The rest is send to browser unchanged and interpreted as normal HTML code
have a look at:
keep in mind that all pages should be end in .php not  .html

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Salaheldien ElryahCommented:
you need 2 pages first for form called(contact.html) and second for action form we called (send.php) here

<!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"><!-- InstanceBegin template="/Templates/index.dwt" codeOutsideHTMLIsLocked="false" -->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<!-- InstanceBeginEditable name="doctitle" -->
<title>Untitled Document</title>
<!-- InstanceEndEditable -->
<!-- InstanceBeginEditable name="head" -->
<style type="text/css"> 
body  {
	font: 100% Verdana, Arial, Helvetica, sans-serif;
	background: #666666;
	margin: 0; /* it's good practice to zero the margin and padding of the body element to account for differing browser defaults */
	padding: 0;
	text-align: center; /* this centers the container in IE 5* browsers. The text is then set to the left aligned default in the #container selector */
	color: #000000;
.twoColFixLtHdr #container { 
	width: 780px;  /* using 20px less than a full 800px width allows for browser chrome and avoids a horizontal scroll bar */
	background: #FFFFFF;
	margin: 0 auto; /* the auto margins (in conjunction with a width) center the page */
	border: 1px solid #000000;
	text-align: left; /* this overrides the text-align: center on the body element. */
.twoColFixLtHdr #header { 
	background: #DDDDDD; 
	padding: 0 10px 0 20px;  /* this padding matches the left alignment of the elements in the divs that appear beneath it. If an image is used in the #header instead of text, you may want to remove the padding. */
.twoColFixLtHdr #header h1 {
	margin: 0; /* zeroing the margin of the last element in the #header div will avoid margin collapse - an unexplainable space between divs. If the div has a border around it, this is not necessary as that also avoids the margin collapse */
	padding: 10px 0; /* using padding instead of margin will allow you to keep the element away from the edges of the div */
.twoColFixLtHdr #sidebar1 {
	float: left; /* since this element is floated, a width must be given */
	width: 200px; /* the actual width of this div, in standards-compliant browsers, or standards mode in Internet Explorer will include the padding and border in addition to the width */
	background: #EBEBEB; /* the background color will be displayed for the length of the content in the column, but no further */
	padding: 15px 10px 15px 20px;
.twoColFixLtHdr #mainContent { 
	margin: 0 0 0 250px; /* the left margin on this div element creates the column down the left side of the page - no matter how much content the sidebar1 div contains, the column space will remain. You can remove this margin if you want the #mainContent div's text to fill the #sidebar1 space when the content in #sidebar1 ends. */
	padding: 0 20px; /* remember that padding is the space inside the div box and margin is the space outside the div box */
.twoColFixLtHdr #footer { 
	padding: 0 10px 0 20px; /* this padding matches the left alignment of the elements in the divs that appear above it. */
.twoColFixLtHdr #footer p {
	margin: 0; /* zeroing the margins of the first element in the footer will avoid the possibility of margin collapse - a space between divs */
	padding: 10px 0; /* padding on this element will create space, just as the the margin would have, without the margin collapse issue */
.fltrt { /* this class can be used to float an element right in your page. The floated element must precede the element it should be next to on the page. */
	float: right;
	margin-left: 8px;
.fltlft { /* this class can be used to float an element left in your page */
	float: left;
	margin-right: 8px;
.clearfloat { /* this class should be placed on a div or break element and should be the final element before the close of a container that should fully contain a float */
    font-size: 1px;
    line-height: 0px;
<script src="SpryAssets/SpryValidationTextField.js" type="text/javascript"></script>
<link href="SpryAssets/SpryValidationTextField.css" rel="stylesheet" type="text/css" />
<!-- InstanceEndEditable -->
<!--[if IE 5]>
<style type="text/css"> 
/* place css box model fixes for IE 5* in this conditional comment */
.twoColFixLtHdr #sidebar1 { width: 230px; }
<![endif]--><!--[if IE]>
<style type="text/css"> 
/* place css fixes for all versions of IE in this conditional comment */
.twoColFixLtHdr #sidebar1 { padding-top: 30px; }
.twoColFixLtHdr #mainContent { zoom: 1; }
/* the above proprietary zoom property gives IE the hasLayout it needs to avoid several bugs */
<body class="twoColFixLtHdr">
<!-- InstanceBeginEditable name="EditRegion1" -->
<div id="container">
  <div id="header">
    <!-- end #header -->
  <div id="mainContent">
    <h1> Contact Form</h1>
    <form id="form1" name="form1" method="post" action="send.php">
<span id="sprytextfield1">
          <input type="text" name="name" id="name" />
        <span class="textfieldRequiredMsg">A value is required.</span></span>
      <p><span id="sprytextfield2">
        <input type="text" name="email" id="email" />
      <span class="textfieldRequiredMsg">A value is required.</span><span class="textfieldInvalidFormatMsg">Invalid format.</span></span></p>
        <label>Comments:<br />
<textarea name="message" id="message" cols="45" rows="5"></textarea>
          <input type="submit" name="send" id="send" value="Submit" />
        <input name="ClearForm" type="reset" id="ClearForm" value="Clear Form" />
    <!-- end #mainContent -->
  <!-- This clearing element should immediately follow the #mainContent div in order to force the #container div to contain all child floats -->
  <br class="clearfloat" />
  <div id="footer">
    <!-- end #footer -->
  <!-- end #container -->
<script type="text/javascript">
var sprytextfield1 = new Spry.Widget.ValidationTextField("sprytextfield1");
var sprytextfield2 = new Spry.Widget.ValidationTextField("sprytextfield2", "email");
<!-- InstanceEndEditable -->
<!-- InstanceEnd --></html>
----------------------------end page----------------
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
// get posted data into local variables
$EmailFrom = Trim(stripslashes($_POST['email'])); 
$EmailTo = "youremail@mail.com"; // Change to the email you want to recive messages to
$Subject = "Your Subject"; //Change to whatever subject you want to have in your contact emails
$Name = Trim(stripslashes($_POST['name']));
$Message = Trim(stripslashes($_POST['message']));
// prepare email body text
$Body = "";
$Body .= "Name: ";
$Body .= $Name;
$Body .= "\n";
$Body .= "\n";
$Body .= "Message:";
$Body .= "\n";
$Body .= $Message;
$Body .= "\n";
// send email 
$success = mail($EmailTo, $Subject, $Body, "From: <$EmailFrom>");
// redirect to success page 
if ($success){
  print "<meta http-equiv=\"refresh\" content=\"0;URL=your_thankyou_page.html\">"; //Change the "ok.html" to your success page 
  print "<meta http-equiv=\"refresh\" content=\"0;URL=your_error_page.html\">"; //Change the "error.html" to your error page

Open in new window

Salaheldien ElryahCommented:
is your linux server gor pear mail installed or something else

I have a sendmail.php if you want to use it as it collects all the inputs through a loop so your can use it on any form to email

then use
<form action="sendmail.php" method="post" name="form1" class="form">
for the first form element

like I said it has a loop that collects all the elements
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Adobe Dreamweaver

From novice to tech pro — start learning today.