Solved

Dreamweaver 8 contact us form

Posted on 2009-07-05
10
776 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
  • 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
 
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
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

For those who don't know, Adobe Dreamweaver is a popular commercial web editor that enables you to design, build and manage complex websites. The editor is a WYSIWYG (What You See Is What You Get) web editor, which means that you can create your web…
I still run into .cgi files every now and then. In some instances, I actually prefer the simplicity of a .cgi script to other options. Since I use DreamWeaver extensively, what I needed was a way to open .cgi scripts in Dreamweaver. And I wanted to …
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

744 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now