Creative COW SIGN IN :: SPONSORS :: ADVERTISING :: ABOUT US :: CONTACT US
Creative COW's LinkedIn GroupCreative COW's Facebook PageCreative COW on TwitterCreative COW's Google+ PageCreative COW on YouTube
ADOBE DREAMWEAVER:HomeDreamweaver ForumDreamweaver TutorialsFAQAdobe FlashWeb Design

Forms

COW Forums : Adobe Dreamweaver

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Share on Facebook
cow
Jeff CochranForms
by on Jun 10, 2008 at 3:31:35 am

Hello all:

Can anyone give me some advice for coding a form. I have a basic form asking a visitor for their name, email address and a submit button. I'd like the information in the name and email address fields to be emailed to me, but I would also like to have my email account to send an auto-response to the visitor's email address

Can anyone help me figure out how to code this.

Thanks in advance.
JC


Return to posts index
Reply   Like  

Abraham ChaffinRe: Forms
by on Jun 12, 2008 at 6:33:28 pm

Hello,

Creating an Email Form
There are different methods for creating an email submission form.
Method 1 uses HTML code that can be fully created in Dreamweaver and uses the users own email settings to send the email.
Method 2 uses a 3rd party service to send the email (Google free contact form) or go to a site like http://www.mycontactform.com/
Method 3 uses server side scripting that sends the email via the server the web page is hosted on (below is a PHP example)

HTML Version:

To create an HTML mailto form in Dreamweaver, follow these steps:
Create the form - Insert > Form > Form
Set the form properties:
Action: "mailto: email@address.com"
Method: "GET"
Enctype: "text/plain"
Create a submit button - Insert > Form > Button
This will give you a submission form that attempts to use the customer's web browser, email client, and/or OS to send the email.



PHP Version:

Here is a simple PHP script that will allow you to send email via a contact form submission. Be aware that you shouldn't use this form in your website unless you want people to use the form to send you spam messages. You can adapt the code here or Google "PHP contact form" for more examples.
Create a new PHP document and call it whatever.php
Switch to code view and copy and paste the code below
Modify the code as needed
Save the file and upload it to your server
Test it out
<?
if($_REQUEST[message]){ //This checks if the form has been submitted or not

$to="YourEmailAddress@YourDomainName.Com"; // Modify the email address to be the email address you want to receive the email via your form.
$from=$_REQUEST[emailaddress]; // The from variable is set by the form field that was sent
$subject="Contact From Your Website"; // This is the subject of the message being sent to you from your form
$message=$from."- ".$_REQUEST[message]; // This is the message to be sent to you
mail($to,$subject,$message); // This is the actual sending of the email using PHP's mail function http://us.php.net/manual/en/function.mail.php

$confirmto=$_REQUEST[emailaddress]; // The email address we'll send a confirmation to
$confirmsubject="Your Confirmation"; // Confirmation Email Subject
$confirmfrom="noreply@YourDomainName.Com"; // Your confirming emailer address
$confirmmessage="Thank you for your email, we will respond promptly."; // Message to send to confirm
//mail($confirmto,$confirmsubject,$confirmmessage); // Confirmation - uncomment this line to use it

//After the message is sent we will display a thank you message
?>
Thank you... Your message has been sent.

<? } else { // If the form has not been submitted show the form ?>

<form method="post" action="">
Email: <input type="text" name="emailaddress"><br>
Message: <br>
<textarea name="message"></textarea><br>
<input type="submit" value="send" />
</form>

<? } // Closing tag of the if and else statements ?>




Abraham


Return to posts index
Reply   Like  

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
Share on Facebook


FORUMSTUTORIALSMAGAZINESTOCKYARDVIDEOSPODCASTSEVENTSSERVICESNEWSLETTERNEWSBLOGS

Creative COW LinkedIn Group Creative COW Facebook Page Creative COW on Twitter
© 2013 CreativeCOW.net All rights are reserved. - Privacy Policy

[Top]