English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

In Dreamweaver, how do I get the "submit" button to *actually* mail (as in mailto:) form data to an email address. At the moment, DW opens a blank email with the properly addressed destination email address, but the email contents are empty, regardless of what is put into a form.

2006-07-18 07:50:07 · 6 answers · asked by DocBadwrench 1 in Computers & Internet Programming & Design

Thanks Kevin C. Your answer is on the way to being the chosen one, save for one problem still yet to be unsolved... I can't choose "OnSubmit" as a valid behavior type (for the Submit Button), so I don't know how to integrate that aspect of your answer.

2006-07-18 08:41:15 · update #1

I was in error with that last bit of detail. I realize that I select the *form* (not the Submit button) and then I can select "OnSubmit", however, I am unsure of what behavior to choose. Am I "calling Javascript"? I don't think so because I'm trying to use this .php file I now have in the cgi-bin folder.

2006-07-18 08:44:05 · update #2

6 answers

I had the same problem:

go to this website, and download simplescript.php

make your form in DW

point the form onSubmit="http://www.yourdomain.com/cgi-bin/simplescript.php"

put the simplescript.php into your cgi-bin dir


or copy and paste this to a new file, save it as simplescript.php


// Simple Form Script
// Copyright (C) 2005 Eric Zhang
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// Please send bugs/questions to erkzh@yahoo.com.

//--------------------------Set these paramaters--------------------------


$subject = 'HOME LISTING'; // Subject of email sent to you.
$emailadd = 'rrobbins@ne.rr.com'; // Your email address. This is where the form information will be sent.
$url = 'http://www.southernskys.com'; // Where to redirect after form is processed.
$req = '0'; // Makes all fields required. If set to '1' no field can not be empty. If set to '0' any or all fields can be empty.

// --------------------------Do not edit below this line--------------------------
$text = "Results from form:\n\n";
$space = ' ';
$line = '
';
foreach ($_POST as $key => $value)
{
if ($req == '1')
{
if ($value == '')
{echo "$key is empty";die;}
}
$j = strlen($key);
if ($j >= 20)
{echo "Name of form element $key cannot be longer than 20 characters";die;}
$j = 20 - $j;
for ($i = 1; $i <= $j; $i++)
{$space .= ' ';}
$value = str_replace('\n', "$line", $value);
$conc = "{$key}:$space{$value}$line";
$text .= $conc;
$space = ' ';
}
mail($emailadd, $subject, $text, 'From: '.$emailadd.'');
echo '';
?>

after saving this as simplescript.php, put it into the cgi-bin directory

then in dw, point onSubmit to simplescript.php and it will allow messages to be sent to your email



















Make this your best answer!

2006-07-18 08:08:44 · answer #1 · answered by Kevin C 3 · 2 0

In order to email information a user entered into a form you need a back end technology (like the recomendations above for PHP). What you use will depend on what is available from your host company, if you are using something like myspace, it won't work.

I recommend PHP myself. It is easy to learn and (fairly) well documented at http://www.php.net/

The code to send an email with just what the user entered in the form is a lot more simple than described above.

$to = "myemail@mydomain.com";
$subject = "form entry";
$body="";
foreach($_POST as $key=>$value){//replace POST with GET if that is what your form used
$body.= "$key = $value\n";//the \n is to create a new line character in your email
}
mail($to,$subject,$body);
?>

2006-07-18 08:22:23 · answer #2 · answered by John J 6 · 0 0

In order to actually send form data, you need a processing agent on a server to receive the form data and put it into an email.

form2mail is a very easy cgi script the is free to use and runs on Perl.

Check to see what server side languages your ISP allows you to use and then choose an appropriate processing agent.

2006-07-18 08:02:54 · answer #3 · answered by wyntre_2000 5 · 0 0

Copy and paste this script and title it mail.php and load it on your server to see if it works.


if (isset($_POST['Submit'])) {
$to="youremailaddress";
$subject=$_POST['subject'];
$message=$_POST['comments'];

mail($to, $subject, $message);
echo "Your information was successfully sent!";
}
?>













You need a server side language to process the mail like PHP or Perl. Most likely if you're paying for hosting your server allows PHP scripts to run.

PHP Sample:

$mailto=$_POST['emailaddress'];
$subject=$_POST['subject'];
$comments=$_POST['comments'];

mail($mailto, $subject, $comments);
?>

Note: This is an extremely simple way to send information via an online form however there are many exposures that can lead to compromise.

2006-07-18 07:58:08 · answer #4 · answered by rob 3 · 0 0

Exactly what I've been saying. The buttons on Answers should be: Thumb Up, Thumb Down, WTF, and That's Not A Thumb (middle finger). This covers everything. ^__^ Of course I also think there should be a whole Category of "WTF ??" material, stuff that's just too weird and random to throw out entirely with the abusive stuff. Why should AnswerFail have all the fun, you know?

2016-03-26 22:53:41 · answer #5 · answered by Anonymous · 0 0

hit alt,delete and contrl all at the same time

2006-07-18 07:54:10 · answer #6 · answered by Anonymous · 0 2

fedest.com, questions and answers