Solved

Dreamweaver 8 contact us form

Posted on 2009-07-05
10
791 Views
Last Modified: 2015-01-05
Hi,

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">
              <tr>
                <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" />
                </label></td>
              </tr>
            <tr>
              <td>Your e-mail address: </td>
                <td colspan="2"><label>
                  <input name="txtYourEmail" type="text" id="txtYourEmail" size="40" />
                </label></td>
              </tr>
            <tr>
              <td>Comments:</td>
                <td colspan="2"><label>
                  <textarea name="txtComments" cols="38" rows="5" id="txtComments"></textarea>
                </label></td>
              </tr>
            <tr>
              <td>&nbsp;</td>
                <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>
            </tr>
                  </table>
        </div>
      </form>

Open in new window

0
Comment
Question by:MidlandR
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
  • 2
  • +2
10 Comments
 
LVL 4

Expert Comment

by:stevepicks
ID: 24780005
Are you gonna use PHP to make it validate and post email? Is your server php enabled?
0
 
LVL 2

Expert Comment

by:Erbureth
ID: 24780009
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']."

$_POST['txtComments']);
?>


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.
0
 
LVL 1

Author Comment

by:MidlandR
ID: 24780029
Hi,

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.
0
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 2

Expert Comment

by:Erbureth
ID: 24780047
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
0
 
LVL 4

Accepted Solution

by:
stevepicks earned 500 total points
ID: 24780071
have a look at:
http://www.thewebhelp.com/php/php_contact_form_with_image_validation/
keep in mind that all pages should be end in .php not  .html
0
 
LVL 2

Expert Comment

by:suntoya
ID: 24780797
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" -->
<head>
<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. */
	background:#DDDDDD; 
} 
.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 */
	clear:both;
    height:0;
    font-size: 1px;
    line-height: 0px;
}
--> 
</style>
<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; }
</style>
<![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 */
</style>
<![endif]--></head>
 
<body class="twoColFixLtHdr">
<!-- InstanceBeginEditable name="EditRegion1" -->
<div id="container">
  <div id="header">
    <h1>Contact</h1>
    <!-- end #header -->
  </div>
 
  <div id="mainContent">
    <h1> Contact Form</h1>
    <form id="form1" name="form1" method="post" action="send.php">
<span id="sprytextfield1">
        <label>Name:
          <input type="text" name="name" id="name" />
        </label>
        <span class="textfieldRequiredMsg">A value is required.</span></span>
      <p><span id="sprytextfield2">
      <label>Email:
        <input type="text" name="email" id="email" />
      </label>
      <span class="textfieldRequiredMsg">A value is required.</span><span class="textfieldInvalidFormatMsg">Invalid format.</span></span></p>
      <p>
        <label>Comments:<br />
<textarea name="message" id="message" cols="45" rows="5"></textarea>
        </label>
      </p>
      <p>
        <label>
          <input type="submit" name="send" id="send" value="Submit" />
        </label>
        <input name="ClearForm" type="reset" id="ClearForm" value="Clear Form" />
      </p>
    </form>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <!-- end #mainContent -->
  </div>
  <!-- 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">
    <p>&nbsp;</p>
    <!-- end #footer -->
  </div>
  <!-- end #container -->
</div>
<script type="text/javascript">
<!--
var sprytextfield1 = new Spry.Widget.ValidationTextField("sprytextfield1");
var sprytextfield2 = new Spry.Widget.ValidationTextField("sprytextfield2", "email");
//-->
</script>
<!-- InstanceEndEditable -->
</body>
<!-- InstanceEnd --></html>
----------------------------end page----------------
send.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<?php
 
// 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 
}
else{
  print "<meta http-equiv=\"refresh\" content=\"0;URL=your_error_page.html\">"; //Change the "error.html" to your error page
}
?>

Open in new window

0
 
LVL 2

Expert Comment

by:suntoya
ID: 24780806
0
 
LVL 30

Expert Comment

by:IanTh
ID: 24781132
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
sendmail.txt
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
problems opening dw files with cs6 8 295
Update 2 tables at the same time 3 469
CSS Layout Help 7 238
404 Not found. The resource requested could not be found on this server! 18 370
Adobe Dreamweaver CS5 is a WYSIWYG web page editor that has advanced HTML, CSS, and Javascript rendering functionality and is probably the most well-known HTML editor available. Much of Dreamweaver's appeal centers around the Design View interfac…
This article is very specific and is only intended to help if you are installing Dreamweaver 8 in a Windows 7 environment with Office 2007 installed.   I'm not sure why Microsoft tends to release OS' that should not be released but they do.  Windows…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question