Welcome to Dagon Design. In addition to free scripts, WordPress plugins, and articles, we offer a variety of services including custom theme design, plugin creation, and PHP scripting. Contact me for more information.

Version 5.8   Updated Sunday, July 5th, 2009 at 8:20pm

Secure PHP Form Mailer Script

This is the PHP version of my secure form mailer script. This script has a wide range of features including: an easy to use dynamic form generation system (any number of fields, in any order), multiple recipients, multiple file attachments, optional auto reply feature, an image verification system, numerous security features (including protection against email header injection), a message template system, multiple languages, and too many other things to list. This script was designed to be easy to use, while still being extremely flexible. If you just want a simple contact form, you can set one up with just a few clicks. For those of you who need something a bit more advanced, you can completely customize script plugin to fit your needs – whether it is 5 fields or 500. A WordPress plugin version is also available. ReCaptcha support has also been added, as well as support for storing the data in a delimited file.

You can see a very basic implementation of the WordPress plugin version of this script on this site’s contact page.

Notice: WordPress Users

Information on the WordPress plugin version of this script

Languages

As of the latest release, this script contains language files for:

English, Belarussian, Brazilian Portuguese, Catalan, Czech, Danish, Dutch, Estonian, Finnish, French, German, Greek, Italian, Japanese, Norwegian Bokmaal, Polish, Portuguese, Romanian, Russian, Slovak, Slovene, Spanish, Swedish, Turkish, Vietnamese

If you would like to submit a language file please contact me.

WordPress vs PHP Versions

To make things easier to find, the two versions of this script share much of the same documentation. While the basic features are the same, there are several differences, so be sure to reference the proper page.

Table of Contents

Due to the size of this page, I have split everything up into sections:



Download

  If you have found this page useful, please consider donating. Thanks!



Changelog

Since both the WordPress and non-WordPress versions of this script are updated together, the changelog below reflects both versions.

  • 07-05-09 – v5.8 Added Estonian language. Added code to check for duplicate field names. Can now use commas in checkbox descs. Fixed garbled auto-reply messages. Adjusted the displaying of uploaded file names in the email message. mb_encode_mimeheader error in WP fixed. Other adjustments to email headers. Added ‘id’ declaration to select boxes. Fixed incorrect example code in the instructions. Other minor changes.
  • 02-22-09 – v5.7 Fixed issues regarding the saving of attached files, data selection values not being recorded, and various minor fixes. Inline styles have been removed from the two field items that contained them.
  • 10-19-08 – v5.6 Added javascript date chooser field. Added html code field. Adjustments for better character set support. Fixed bug with spaces in selrecip. Commas can now be used in check boxes, radio buttons, and select boxes (see field info below). Timestamp option added for saving to data file. New email validation code (from http://code.google.com/p/php-email-address-validation/). New language added: Vietnamese
  • 09-18-08 – v5.51 Captcha now displays properly in Safari and Chrome. All of the auto-reply issues should now be resolved. Few changes to headers for compatibility.
  • 08-24-08 – v5.5 Fixed various undefined index errors, code changes to improve xhtml validity, attachments can now be saved to the server (not just emailed), improved email header handling for language support, can now show url (of form) in message, fixed issue with required select boxes, added Belarussian, Czech, and Japanese languages, clickable labels for radio and checkbox items, and various other fixes.
  • 05-13-08 – v5.41 Added support for saving form data to a delimited file. Fixed a few issues including the loading of recaptcha files, and attachment support.
  • 11-25-07 – v5.4 Added support for ReCaptcha, manual form code entry, 5 new languages (Catalan, Danish, Polish, Romanian, and Turkisk), several html and css tweaks, and other misc. updates.
  • 07-27-07 v5.33 – Few minor bugs fixed. Finnish language file added.
  • 07-08-07 v5.32 – Error messages affecting form alignment issue resolved. Italian and Slovak language files added.
  • 06-18-07 v5.3 – ‘undefined index’ errors fixed, image verification adjustments, p tags removed from fieldsets, changes to help html validity, various other fixes.
  • 05-09-07 v5.25 – ‘Thank you’ message now allows for form field inputs as well.
  • 05-08-07 v5.24 – Auto-reply message now allows for form field inputs. Language selection issue resolved. str_replace errors (on certain servers) fixed. Norwegian BokmÃ¥l language file added.
  • 05-01-07 – Not a version update. Greek and Swedish language files added.
  • 04-18-07 v5.23 – Renamed email verification function (to fix conflicts with other scripts). The GD check is now disabled if you are not using image verification. Added two new language files – Portuguese and Russian.
  • 04-18-07 – Not a version update. Brazilian Portuguese language file has been added.
  • 04-03-07 v5.22 – Email generation code has been modified to try to work with more servers. French language file has also been updated.
  • 03-28-07 v5.21 – Highly recommended update – Fixed an issue with the verification code not being handled properly. Nothing else has been changed.
  • 03-25-07 v5.2 – Email generation improved – should work better in more email clients. Many issues with message generation and field types have been fixed. Better support added for field requirement options. CSS for various fields updated. Issue with submit button fixed. Dutch and French language files added. Checkbox and drop-down issues resolved. Email verification method improved. Undefined index errors fixed, and much more. Be sure to read the updated instructions for the field types.
  • 03-13-07 v5.1 – Lots of updates: Slash escaping has been improved, p tags are now added around form elements, each form instance can have its own language setting, the language selection issue has been fixed, improved foreign character support in messages, check box handling improved, and a new optional auto reply feature has been added.
  • 02-06-07 v5.0 – This is a major update from version 4, and because of this, I have completely re-written this page, and removed the old changelog to save space.


Installation

  • 1) Download and uncompress dd-formmailer.zip
  • 2) Upload the entire dd-formmailer directory to your server
  • 4) Configure your options (explained below)
  • 5) Add the form to your page (explained below)


Required Configuration

While this script is highly configurable, some of you may just want to get up and running quickly with a simple (and secure) contact form. If so, these are the minimum options you need to configure within the file:

Standalone Option

$standalone – If you plan to use this script by itself (not included from another PHP file), set this option to TRUE, and it will generate a proper html header and footer. If you want to change the basic header and footer, they are found near the bottom of this script.

Path to CSS

$path_to_css – If you are using the standalone option, enter the relative path to your CSS file so it can be declared properly in the header. For those of you including this script in another PHP file, be sure to manually add the CSS declaration in the header section of your page, like this:

<link rel="stylesheet" href="(path to dd-formmailer.css)" type="text/css" media="screen" />

If you plan to use the javascript date field, you will also have to include the following line:

<script type="text/javascript" src="(location of date_chooser.js)"></script>

Language Setting

$language – The relative path to the language file you want to use.

Full URL to Script

$script_path – The full URL to dd-formmailer.php (or whatever you have renamed it to)

Full URL to Contact Page

$path_contact_page – If you are running this script in standalone mode, leave this blank. Otherwise, enter the full URL to the page that is displaying the form

Recipient Data

$recipients – If you are just sending email to a single address, enter it here. For more advanced usage such as multiple recipients, CC, BCC, etc.. more information is below

The other settings are optional, and are explained below.



Other Configuration Options

This is a listing of the other configurable options in the script. These are optional, but allow for much greater customization

Form Structure – This is where you define the fields that will be used on this form. There are a lot of options available for this, and they will be explained further down as well

Manual Form Code – This is a very advanced option that has its own section on this page.

Wrap messages – This option wraps message lines to 70 characters to comply with RFC specifications

Save attachments – If enabled, attached files will be saved to a directory on the server instead of attached to the email.

Save attachment path – Where files will be saved, if attach_save is enabled. This is the full path on the server, with a trailing slash. Directory must have write permissions. Example: /home/user/public_html/uploads/

Show required – If enabled, required fields will be marked with an asterisk

Show URL – If enabled, the URL the script is running from will be added to the message

Show IP and Hostname – If enabled, the visitor’s IP and hostname are added to the message

Special Fields – Sender name, Sender email, and Email subject – These options help generate the email headers. If you enter a field name, it will be replaced by user input from that field. For example, if you have a form field called fm_name and you use that as the Sender name option, the visitor’s name will be used as the From field in the email. You can also combine them. If you have a field called fm_firstname and fm_lastname you could enter ‘fm_lastname, fm_firstname’ – For the Sender email option, just use your email field

Max upload size – This allows you to set the maximum file size (in bytes) for attachment uploads. This option only applies if the setting is lower than the value already set in your php.ini file

Message Structure – This feature is optional. If left blank, the script will generate the email message itself, which will include all the data the visitor submits. If you choose to use this option, it will act as the message template. Simply enter your custom text, including your field names. When the message is generated, the field names will be replaced by the user input from those fields. Note: Since the script will just do a search and replace for field names, be sure they are unique enough. Example: A check for fm_message2 would also get triggered by fm_message when the script adds in the input.

Success Message – This is the text that is shown after the email has been sent. You can also use field names in this, and the user input from those fields will be used to generate the message.

Auto Reply – This is an optional feature that allows you to automatically send a pre-defined message back to those who contact you. More information on this is below

Image Verification Method – There are three choices for image verification. It can be disabled, you can use the script’s built-in system (a simple captcha – requires GD support on the server), or you can use the ReCaptcha system (requires signing up for a free account at recaptcha.net)

Basic Method Options – If using the basic image verification method, you can choose the text and background color for the image (3 or 6 digit hex codes). By default, the script will try and choose the best file format for the verification image, but if it gives you any problems, you can manually specify the format to see what works best for your server.

ReCaptcha Method Options – If using the ReCaptcha image verification method, you must enter the public and private keys given to you at the ReCaptcha website. These are used to generate the verification form, and the keys are specific to the website under your account (meaning if you use this script on multiple sites, you need a set of keys for each).

Save Data to File – When enabled, the form input will be saved to a delimited file.

Still Send Email – When using the delimited file feature, this option determines whether or not the script still sends the email.

Data Path – The path to the file the data will be written to – relative to the script’s directory. Be sure to give this file write access.

Delimiter – Fields will be separated by this character. If this character is found in the actual data, it will be removed for simplicity.

Newlines – Newlines in input, such as text areas, will be replaced by this, to keep the data on a single line in the file.

Timestamp – Adds the date/time to the beginning of each line in your data file. This uses the PHP date format. Leave blank to disable.



Other Customizations

With the exception of the text defined in the options, all text visible to the visitor is contained within the language file.

Visual changes to the form can be made in the included CSS file. The class names used in the examples below already exist within the CSS.



Usage

If you are using the standalone option, all you have to do is open the URL to the script file in your browser.

If you are not using the standalone option, you can include the script in your existing PHP file with the following code:

<?php include('dd-formmailer.php'); ?>

Be sure to use the relative path to the script file.



Advanced Recipient Options

As mentioned above, if you want to send the messages to a single recipient, just enter the email address in the recipients option. To send to multiple recipients, separate the addresses with a | (pipe) character, and use one of the following prefixes for each: to= cc= bcc=

Examples:

to=user1@domain.com|to=user2@domain.com
to=user1@domain.com|cc=user2@domain.com
to=user1@domain.com|cc=user2@domain.com|bcc=user3@domain.com

You can have as many of each type (to, cc, bcc) as you like, and they can be in any order, although the first one in the list is the always the primary recipient, and must use to=

For those of you who want to let the vistor choose the recipient from a drop-down box, first you must enter selrecip in the recipients field. Then you must add a new line in the form structure box. Example:

type=selrecip|class=fmselect|label=Recipient|data=(select),
User1,user1@domain.com,User2,user2@domain.com

The type must be selrecip, but you can use whatever you like as the CSS class, and label. The first item in the data parameter is the default (unselected) option. After that are the names and email addresses. You can add in as many as you like – just keep them in the proper order (name,email,name,email,etc..). Only the names are visible within the HTML for privacy reasons.

The ‘(select)’ item is the default selection, which the user must change to submit the form. You can change the ‘(select)’ text if you choose.



Advanced Form Structure

This script uses a dynamic form generation system, which means that by simply adding a new line to the form structure, you will have a new field in your form. You can have as many fields as you like, and in any order. The only field type that you must absolutely have is the verify field if you are using the image verification option. All of the fields are explained below, with examples. Separate each field type with a single newline in the form structure option. (Some of the examples below are bit long, so they are wrapped to the next line – be sure that the only newlines are after each field type when adding them to your form structure.)

These are the different parameters that apply to most of the field types (Special exceptions and parameters unique to a particular field are listed under each field type):

  • type – This tells the script what type of field you are adding.
  • class – The CSS class used to style the field. The classes used in the examples below already exist in the CSS file.
  • label – Text that is shown next to the field.
  • fieldname – The name of the form field (must be unique).
  • max – Maximum number of characters allowed.
  • req – (OPTIONAL) If you want to require a field, set this to true. If not, do not add it.
  • default – (OPTIONAL) This allows you to specify the default value of a field.

TEXT

This is a standard text input field.

type=text|class=|label=|fieldname=|max=|[req=true]|[ver=]|[default=]

The text field type has a special parameter – ver – which can be used to verify the input. You can choose email (which checks that the input is a proper email address) or url (which checks that the input is not only a proper URL, but that it actually exists). If you do not want to use either validation option, do not add this parameter.

Examples:

type=text|class=fmtext|label=Name|fieldname=fm_name|max=100|req=true 

type=text|class=fmtext|label=Age|fieldname=fm_age|max=100|
default=Enter your age! 

type=text|class=fmtext|label=Email|fieldname=fm_email|max=100|req=true|
ver=email 

type=text|class=fmtext|label=URL|fieldname=fm_url|max=100|ver=url

DATE

This is a javascript pop-up date chooser.

type=date|class=|label=|fieldname=|[req=true]

This field type generates a text box with a calendar icon next to it. The user can enter a date manually, or click on the icon to see a small calendar that they can choose a date from.

To change this image, just replace calendar.gif in the script directory. Either give your file the same name, or search and replace the name in the script file.

Example:

type=date|class=fmdate|label=Event Date|fieldname=fm_date|req=true 

HTML

This field type lets you insert html, or other code, anywhere in your form.

type=html|text=

Example:

type=html|text=<p>Hello!</p> 

PASSWORD

This is a standard password field. It is exactly like a text field, except it shows asterisks when the user types.

type=password|class=|label=|fieldname=|max=|[req=true]|[confirm=true]

The password field type also has a special parameter – confirm – which if set to true, it duplicates the password field, so that the visitor has to confirm their input. If you do not want to use this, do not add the confirm parameter.

Examples:

type=password|class=fmtext|label=Password|fieldname=fm_pass|max=100|
req=true|confirm=true
 
type=password|class=fmtext|label=Secret Word|fieldname=fm_secret|max=100

TEXTAREA

This is a standard text area, for multiple lines of text.

type=textarea|class=|label=|fieldname=|max=|rows=|[req=true]|[default=]

The textarea field type has a special parameter – rows which defines the number of rows in the field (required for valid html).

Examples:

type=textarea|class=fmtextarea|label=Message|fieldname=fm_message|
max=1000|rows=6
 
type=textarea|class=fmtextarea|label=Message|fieldname=fm_message|max=1000|
rows=4|req=true
 
type=textarea|class=fmtextarea|label=Message|fieldname=fm_message|max=1000|
rows=10|req=true|default=Type here!

WIDETEXTAREA

This is exactly the same as the standard textarea, except that it’s wider, and the label is above it instead of to the side.

type=widetextarea|class=|label=|fieldname=|max=|rows=|[req=true]|[default=]

Example:

type=widetextarea|class=fmtextwide|label=Message|fieldname=fm_message|
max=1000|rows=10|req=true

* Note that the normal textarea, and wide textarea fields use a different CSS class for formatting.


VERIFY

This field is required if you are using the basic verification method. It does not apply if you are using the ReCaptcha method. It is used for placement of the verification image (and associated text box) in the form.

type=verify|class=|label=

Example:

type=verify|class=fmverify|label=Verify

FULLBLOCK and HALFBLOCK

These are not standard form fields, but simply a way you can add text to your form. The full block is as wide as a wide textarea, while the half block is aligned with other standard fields. You can use basic HTML in your text if you like.

type=fullblock|class=|text=
type=halfblock|class=|text=

Examples:

type=fullblock|class=fmfullblock|text=This could be some sort of 
introduction message.
 
type=halfblock|class=fmhalfblock|text=This could be used to explain a field 
in greater depth.

OPENFIELDSET and CLOSEFIELDSET

These do just what the name implies – they open and close a fieldset in your form so you can help group fields together. It also allows you to specify a legend for the fieldset (required for valid HTML).

type=openfieldset|legend=
type=closefieldset

Examples:

type=openfieldset|legend=Your Information
 
(other field would go between these)
 
type=closefieldset

CHECKBOX

The checkbox field can be used to generate a single checkbox, or a group of them. The usage is a bit different than the other fields.

type=checkbox|class=|label=|data=
(fieldname),(text),(checked),(REQUIRED),
(fieldname),(text),(CHECKED),(REQUIRED)...

As you can see, the checkbox data is a comma separated list of four items per checkbox:

  • fieldname – A unique fieldname for each checkbox in the form.
  • text – The text shown to the right of each checkbox.
  • checkedtrue or false. This allows you to make checkboxes checked by default.
  • requiredtrue or false. If true, it means that the user must check the box to send the message. Mainly useful for ‘check here to agree’ type situations.

*NOTE* Because this field type uses commas to separate data, if you would like a comma to be displayed in your data, simply use two. It will be replaced later in the code.

Examples

type=checkbox|class=fmcheck|label=I Agree|data=fm_agree,I agree to the 
terms,false,true
 
type=checkbox|class=fmcheck|label=Interests|data=fm_i1,Computers,false,
false,fm_i2,Art,false,false,fm_i3,Music,false,false

RADIO

This field generates a group of radio buttons. Radio buttons are similar to checkboxes, except that they are treated as a group, and only one option may be selected.

type=radio|class=|label=|fieldname=|[req=true]|[default=]|data=(text),(text),
(text)...

The req and default items are optional. req, if set to true, makes the field required. default can be set to the option number you want to be selected by default (starting at 1).

*NOTE* Because this field type uses commas to separate data, if you would like a comma to be displayed in your data, simply use two. It will be replaced later in the code.

Examples:

type=radio|class=fmradio|label=Gender|fieldname=fm_gender|data=Male,Female
 
type=radio|class=fmradio|label=Color|fieldname=fm_color|req=true|default=1|
data=Unspecified,Red,Green,Blue

SELECT

The select field generates either a standard drop-down box, or a multi-select box, depending on the multi option. Option groups are supported as well.

type=select|class=|label=|fieldname=|[multi=true]|[req=true]|data=(#group),
(text),(text),(#group),(text)...

The multi and req options are optional.

If the field is required, the first option you have in the data paramater will be the default, which tells the user they need to select one of the options. If they do not change the default option, and it is required, they will receive an error.

The data field is just a list of the options, separated by a comma. To define the start of an option group, just prefix the group name with a # as shown below.

*NOTE* Because this field type uses commas to separate data, if you would like a comma to be displayed in your data, simply use two. It will be replaced later in the code.

Examples:

type=select|class=fmselect|label=Age|fieldname=fm_age|req=true|
data=(select),0-30,31-60,61-90,91-120
 
type=select|class=fmselect|label=Colors|fieldname=fm_colors|
multi=true|req=true|data=Red,Green,Blue
 
type=select|class=fmselect|label=Choose|fieldname=fm_choose|
data=#Category1,item1,item2,#Category2,item3,item4

FILE

The file field generates a file upload box. As with all other fields, you can add as many of these as you like, as this script supports not only attachments, but multiple attachments. The only thing to keep in mind is that you may need to find out the limit your server has set for file upload sizes.

type=file|class=|label=|fieldname=|[req=true]|[allowed=1,2,3]

The allowed field is optional, and lets you define a (comma separated) list of file extensions that are allowed to be uploaded. Otherwise, all file types will be allowed.

Examples:

type=file|class=fmfile|label=Upload|fieldname=fm_upload
 
type=file|class=fmfile|label=Upload|fieldname=fm_upload|req=true|
allowed=jpg,jpeg,gif,png


Manual Form Code

This feature allows you to manually specify the code used to generate your form. By default, this script uses the form structure information to dynamically generate the form. While this makes it easier for most people, since they do not have to write any code, it can limit those who need a bit more flexibility in their form structure.

Important Notice: Because this method means you will be writing the form code yourself, and it will not be generated by the script, there is no way for it to automatically insert the PHP code needed to put the user’s input back into the form when there is a validation error. It is just not possible for this to be done automatically due to the nature of the option. The only way this can be accomplished is if you know enough about PHP to insert the code manually yourself. In other words, this is a very advanced option – only for those who are very familiar with HTML forms and PHP.

  • 1) Customize your form using the ‘Form Structure’ option as you would normally – this is required even when using the manual code entry, as it allows for processing of the form.
  • 2) Be sure you have all your options exactly as you want them, and view your newly created form page.
  • 3) View the source of the page, so you can copy the generated html. The code you need is between the following lines:
    <!-- START of Dagon Design Formmailer output -->
    <!-- END of Dagon Design Formmailer output -->
  • 4) You can now customize this form code however you like, as long as the core elements of the form and fields are still in place.
  • 5) Enter your new code into the ‘Manual Form Code’ option. (PHP VERSION NOTICE: Depending on your form code, you may have to ‘escape’ single or double quotes, as you are assigning this code as a string value to the $manual_form_code option!)
  • 6) If everything worked properly, your page will now use the custom form code. Once again, the standard form structure option is still required, as it is still for processing of the form.

You can also adjust the included CSS file to better fit your needs, or completely clear it out and manually create an entire new CSS structure for your task. Keep in mind that if you change any field items (or any options which affect the form code generation), you will have to repeat this process.

To disable the manual form code feature, just clear out the option for it.



Auto Reply Feature

The options page for each instance includes fields to define an auto reply message. This is a pre-defined message that is sent back to the visitor.

To use this option, simply enter the name, email address, subject line, and message for your auto response. To disable this feature, just leave the message field blank.

You can also use field names in the auto reply message, and the user input from those fields will be used to generate the message.



Saving Data to a File

This option allows you to save the form input in a delimited file. Please see above for a full explanation of the options.

With the PHP version of this script, the path to the data file is relative to the location of the script. Be sure to give this file write access.



Other modifications

Redirect after form submission – Method 1

It is possible to use Javascript to redirect the user after the form has been filled out. While this method is not 100% valid (Javascript redirection should go in the HEAD section of the page), it works. To add this feature, first find the following line in the script:

$o .= $sent_message;

And replace it with this:

$o .= '<script><!-- 
window.location= "http://www.mysite.com/" 
//--></script>';

(where mysite.com is the URL you want to redirect to)

Redirect after form submission – Method 2

This is another method you can use to redirect the user after the form has been submitted. First, find this line:

$o .= $sent_message;

And after it, add this:

$o .= '<META HTTP-EQUIV="REFRESH" CONTENT="4;URL=http://www.mysite.com/">';

Where ‘4′ is the number of seconds to wait before refresh, and the ‘http://www.mysite.com/’ is the URL you want to redirect to.

Passing values to the form

To allow values to be passed directly to the form, all you have to do is change all references of $_POST to $_REQUEST (The REQUEST superglobal contains the values of both POST and GET items)

Prevent form data from being resubmitted upon refresh

This feature is included in the WordPress plugin version, but not in the PHP version, because of how it has to be used. To enable the feature when using the script in standalone mode, add the following code after the PHP declaration at the top of the script:

if (count($_POST) > 0) {
  $lastpost = isset($_COOKIE['lastpost']) ? $_COOKIE['lastpost'] : '';
  if ($lastpost != md5(serialize($_POST))) {
    setcookie('lastpost', md5(serialize($_POST)));
    $_POST['_REPEATED'] = 0;
  } else {
    $_POST['_REPEATED'] = 1;
  }
}

If you are not using the standalone option, you must add that code at the very top of the PHP file you are calling the script from. Add PHP tags around it if needed. Just make sure there is no extra whitespace around the PHP tags.

Modifying the script to use HII for image verification

Miro has posted instructions for users wanting to use HII: Read the comment. Notice: Modifications listed in the comments may not apply for new versions of the script.

Using SELRECIP and BCC together

The easiest way to do this, is to find the following line in the script:

$send_status = mail($send_to, $email_subject, $msg, $headers);

If you are using SELRECIP, the message will be sent to whoever the visitor chooses. If you would also like the message to go to someone else, no matter who is chosen, just duplicate that line like so, adding in the address of the secondary recipient:

$send_status = mail("user2@domain.com", $email_subject, $msg, $headers);



Troubleshooting

Fields not working properly/Form is not displaying properly

As stated above, each field item needs to be on a single line in your form structure. Many of the examples above are long, so they do not show up on a single line. Be sure to remove any linebreaks when adding them to your form. One form field statement per line.

Verification image not showing up

The first thing to do is check to make sure your paths are set correctly in the options.

This script automatically chooses the best file type to generate the verification image. If your verification image is not displaying, the problem could be that your server will not properly generate that type of file. You can manually set this using the ‘Force image type’ option in the script. It allows you to manually specify jpeg, gif, or png.

Try all the options to see which works best for you.

Problems sending email

The most common question I receive is ‘Why am I not receiving email from the script?’

There are many reasons this can happen. The first thing to do is make sure you have access to the PHP mail function on your web server, and that there are no restrictions in place that might prevent certain features of this script from working. If you are not sure, please ask your host for information. Unfortunately, I am not able to spend the time troubleshooting general server issues for everyone.

Also try having the script send the messages to another email address (on another domain), just to be sure the problem is not with your email account.

If you believe you can use the PHP mail function and have already tried a different email address, create a small PHP file with the following contents (be sure to use your own email address):

<?php mail('you@domain.com', 'test subject', 'test message'); ?>

Open the file in your browser and then check your mail. If you did not receive the message, something is not set properly on your server, and the trouble is not with this script. Even if other mail scripts work for you, that does not mean this one will, as there are several methods to send mail in PHP.

If you do receive the message, it most likely means that your server is configured to not allow the use of the fourth parameter (extra headers) in the mail() function. To work around this, replace this line:

$send_status = mail($send_to, $email_subject, $msg, $headers);

With this:

$send_status = mail($send_to, $email_subject, $msg);

The only downside is that certain features (such as some header information, and the ability to send to multiple recipients) will be disabled. You may be able to contact your host and have them change this though. Many hosts add in this restriction for security reasons, to protect against unsafe scripts.

Lastly, some servers require an extra parameter for the mail function that specifies who the message is from. In many cases, this must be an email address on the server itself. Example:

$send_status = mail($send_to, $email_subject, $msg, $headers, '-f user@domain.com');

‘Headers already sent’ error

Another common question is the ‘headers already sent’ error message. Without getting into the details, this generally happens when something is output to the browser before a call to set_cookie, header, or a number of other PHP functions. Be sure there is no extra whitespace at the top of your file.

Mail headers showing up in message body / attachments not working

This issue can be caused if your server does not like the return/newline character set being used to end lines of the email headers. If you are experiencing this problem, try changing this line:

if (!defined('PHP_EOL')) define ('PHP_EOL', strtoupper(substr(PHP_OS,0,3) == 'WIN') ? "\r\n" : "\n");

To this:

if (!defined('PHP_EOL')) define ('PHP_EOL', strtoupper(substr(PHP_OS,0,3) == 'WIN') ? "\n" : "\n");

If you require special SMTP settings for mail to be sent

If you have to manually specify the SMTP settings, you can do so with the following code. This is only recommended for advanced users.

ini_set("SMTP","mail.MYDOMAIN.com");
ini_set("smtp_port","587");
ini_set("username","MYUSERNAME@MYDOMAIN.com");
ini_set("password","MYPASSWORD"); 
ini_set('sendmail_from', $sender_email);
$send_status = mail($send_to, $email_subject, $msg, $headers);
ini_restore('sendmail_from');

(Just search for the reference to the mail() function to see where to add it)

Conclusion

Please be sure to read the entire article before asking a question. I spend a lot of time on the scripts and plugins available on this site, and it can be hard to keep up with all the requests. If you need modifications or a custom version, please contact me. Thanks for reading!

  1. 2018
    Mar

    Your script is fabulous. Thank you!

  2. 
    Well firstly great job with the script.
    
    I am a php newb. and i found your script to be easy to understand how ever being a newb and all i found it strange that everything works well with no hassles.. with my luck i was supposed to get errors all over the place... Well this is not the matter at all. I'm in fact struggeling wiht 2 things.
    1. redirect code - in which line do i change the "$o .= $sent_message;" code.. when i change the code in line 1790 with $o .= '<META HTTP-EQUIV="REFRESH" CONTENT="4;URL=http://www.itr.co.za/">'; i get a server error "500" if i use the javascript code i get nothing, no redirect. i want it to redirect to my custom thank you page  http://www.itr.co.za/thankyou.php/
    2. My messages are emailed correctly to me via the script how ever, i get the form body but no input fields for e.g
    Contact Name = Humpty Dumpty
    Contact Email = mydomain@mydomain.co.za
    Subject = When last did the sun shine. ...... I recieve the mail with 
    Contact Name = 
    Contact Email = 
    Subject =         ...... please help
    
    Here is the code:
    
    // FORM STRUCTURE
    // This is used to generate the form. Each form element must be on its own line.
    // Detailed usage instructions can be found on the web page
    
    $form_struct = '
    	type=text|label=Contact Name|fieldname=fm_name|max=15|req=false
    	type=text|label=Company Name|fieldname=fm_cname|max=100|req=false
    	type=text|label=Contact Number|fieldname=fm_cnumb|max=10|req=false
    	type=text|label=Email|fieldname=fm_email|max=50|req=false
    	type=textarea|label=Description|fieldname=fm_description|max=200|rows=10|req=false
    ';
    
    and
    
    // SPECIAL FIELDS
    // These options help generate the email headers. Simply enter a field name,
    // and the user input from that field will be used. You can also combine fields. 
    // For example, if you have a fm_firstname and fm_lastname field, you could 
    // set $sender_name to 'fm_lastname, fm_firstname'
    
    $sender_name = 'fm_name';
    $sender_company = 'fm_cname';
    $sender_number = 'fm_cnumb';
    $sender_email = 'fm_email';
    $email_description = 'fm_description';
    
    Thanks
    

  3. The name, email, phone and subject fields do not have a space between the label and the text field. Verify and text area do and I cannot find the difference.

    http://www.saltlakeexecutivelimo.com/contact/contact.php

  4. 2015
    Peter

    How can I add multiple file uploads? how do i set 2 different unique field names for it?

  5. Hi, I have my own form html page in czech language. I just want to process the data inputed in czech in my form by your php formmailer so the czech language gets displayed properly and then reference and display my own confirmation page. Can you help please?

  6. Hi, very great script, but i´m missing one thing:

    I want the user to upload a picture file (no problem).
    but the file need to be sent by email (no problem) AND be viewed in the success message. the user has to see what he has uploaded in the success page to check it. i did find no answer. could you help me please?

    greetings from germany

  7. 2012
    Caro

    Why is the verification code not working with the safari and IE browsers? I set it all up tested on Firefox, but now I have tested on the others and I get “Errors!No verification code generated”.
    Is there something I can do to fix this? I hope you can help.
    Thanks,
    Caro.

  8. How can I add a message on the top of the form page that goes away when the message is sent?

  9. good

  10. Hi Billy,

    I’m having the same problem that you’re experiencing! I keep getting “DDFM_REQUIREDTAG” on the form. All of the files have been uploaded and I went through the entire PHP “dd-formmailer.php” file to see if I could find the answer. The weird thing is that I took this same exact PHP file from another form that I had used and I never got these “DDFM_REQUIREDTAG” fields on my online form.

    Here’s where you can see the issue. Note: the form works great, but I just have these un-needed DD_REQUIREDTAG statements on my form.
    http://robstathem.com/rws/contact.php

    If anyone has any suggestions for me, I’d greatly appreciate it. I’m back to seeing what else I can do to fix this.

  11. Awesome script! Can I use ONLY the parsing and mail functions?

    I have my own gorgeous custom contact form I would like to use from my home page. I’d rather not switch pages but just wish to parse the contact fields with your FANTASTIC parsing and ip/host collecting agents. If I could make a little jpg of my choice pop up in my homepage as a oonfirmation that would be perfect.

    Possible?

    Thank you!
    HR

  12. 2007
    israeli

    no Hebrew :(

  13. Thank you fo great script, Dagon! Would you be so kind to assist me with my minor issue with it. The problem is in encoding of the email headers and the subject. And the only those I recieve with actual message. In the same time the sender recieves right headers in auto response message. This are the lines i changed

    	$sender_name = ddfm_injection_test($sender_name);
    	$sender_email = ddfm_injection_test($sender_email);
    	$email_subject = ddfm_injection_test($email_subject);
    	
    	if (function_exists('mb_encode_mimeheader')) {
    	$email_subject = mb_encode_mimeheader($email_subject, 'windows-1251', 'Q', '');
    	$sender_name = mb_encode_mimeheader($sender_name, 'windows-1251', 'Q', '');
    	}
    

    as well as those

    	$headers .= 'From: ' . $sender_name . ' <' . $sender_email . '>' . PHP_EOL;
    	$headers .= $extra_recips;
    	$headers .= 'Reply-To: ' . $sender_name . ' <' . $sender_email . '>' . PHP_EOL;
    	$headers .= 'Return-Path: ' . $sender_name . ' <' . $sender_email . '>' . PHP_EOL;
    	$headers .= "Message-ID: <" . time() . "ddfm@" . $_SERVER['SERVER_NAME'] . ">" . PHP_EOL;
    	$headers .= 'X-Sender-IP: ' . $_SERVER["REMOTE_ADDR"] . PHP_EOL;
    	$headers .= "X-Mailer: PHP v" . phpversion() . PHP_EOL;
    
    	$headers .= 'MIME-Version: 1.0' . PHP_EOL;
    //	$headers .= 'Content-Type: multipart/related; boundary="' . $mime_boundary . '"';
    	$headers .= 'Content-Type: multipart/mixed; boundary="' . $mime_boundary . '"';
    
    	$msg .= '--' . $mime_boundary . PHP_EOL;
    	$msg .= 'Content-Type: text/plain; charset="windows-1251"' . PHP_EOL;
    //	$msg .= 'Content-Type: text/plain; charset="iso-8859-1"' . PHP_EOL;
    
    	$msg .= 'Content-Transfer-Encoding: 8bit' . PHP_EOL . PHP_EOL;
    

    Thanks!

  14. Thank you for a great script.
    Thanks a lot.

  15. 2004
    daryll

    is it possible to have check boxes like below

    0 ( thats a check box) red £10
    0 blue £12
    0 yellow £15

    etc

    and have the total displayed , also can this be emailed to the person filling in the form , and to me

  16. Hi Dagon.

    I added a feature to my copy. It verifies that the text field is in dollars. If you like, append the following in its respective places:

    in dd-formmailer.php:

    type=text|class=fmtext|label=Your Offer ($)|fieldname=fm_offer|max=12|req=true|ver=number

    
    /* Check for valid amount in dollars */
    function ddfm_is_valid_number($number)
    {
       // with decimal places... if(ereg('^[0-9]+\.[0-9]{2}$', $number))
       if(ereg('^[0-9]+\$', $number) || ereg('^[$]{1}[0-9]+\$', $number) || ereg('^[0-9]+\.[0-9]{2}$', $number) || ereg('^[$]{1}[0-9]+\.[0-9]{2}$', $number)){
    	 return true;
       } else {
    	 return false;
       }
    }

    
    else if ((strtolower($fs['ver']) == 'number') && ((strtolower($fs['req']) == "true") || ($t != ""))) {
    
    if (!ddfm_is_valid_number($t)) $errors[] = DDFM_INVALIDNUMBER ;
    					}
    

    in English.php:

    
    define('DDFM_INVALIDNUMBER', 'Please enter your offer amount using this numeric format <i>(no commas)</i>: 10000.00');
    

  17. 2002
    billy

    (re:2001) the problem was that i hadn’t uploaded all the necessary files and folders, all is well.

    Thank you for a great script

  18. 2001
    billy

    Hi, the following info is being displayed on the form “DDFM_REQUIREDTAG Name”, i ve tried replacing if (!defined('PHP_EOL')) define ('PHP_EOL', strtoupper(substr(PHP_OS,0,3) == 'WIN') ? "\r\n" : "\n"); but it has no affect.

  19. Is there a way to set the default of one of the dropdown options in type=select, so the HTML reads selected=”selected”? Sorry, I tried looking through the documentation and the comments but couldn’t find anything.

  20. 1999
    Omar Khan

    I am trying to run the form mailer script, Ive installed it properly and added the multiple recipients option as described in the documentation and included it in my website’s contact page but when I run it, it gives me this Error sending message!

    I am using Dreamhost currently where I have the script installed. What can cause this error?

  21. 1998
    ALS

    Has anyone figured out a fix to the attachments being uploaded with permissions of 600? They are not accessible from a web browser because of this.

  22. 1997
    Angelique

    @Joshua (comment #1987) — I had this same issue and just found a workaround. **Note that this assumes you’re using a footer.php file that calls dd-formmailer.php via an include command. It might also work in a straight HTML file, but I’ve not tested that.**

    Above my contact form, I have the following:
    <h2><a name="form"></a>Get in Touch</h2>

    I had previously been using the anchor tag #form to make sure when someone submitted the form, they were returned to the same area in the page to see the success message. But I discovered this also worked in a site where I wanted the contact form to be in every footer. I simply changed the full URL to the contact page to be that anchor tag, like so:

    // FULL URL TO CONTACT PAGE
    // If you are running this script in standalone mode, leave this blank. Otherwise,
    // enter the full URL to the page that is displaying the form
    
    $path_contact_page = '#form';

    Hope this helps you or someone else!

  23. This is a nice script..
    Its simple to learn about it..

    you have done good work.. :-)

    Thanks a lot..!

  24. 1995
    Mike

    Hi I was wondering if there is a way to add content to you email message.

    I have tried these options but no luck on the email ouput
    FULLBLOCK and HALFBLOCK

    I have added them to the form_struct var like so

    type=text|class=fmtext|label=Name|fieldname=fm_name|max=100|req=true

    type=text|class=fmtext|label=Phone|fieldname=fm_phone|max=100|req=true

    type=fullblock|class=fmfullblock|text=This could be some sort of
    introduction message.

    type=halfblock|class=fmhalfblock|text=This could be used to explain a field
    in greater depth.

    type=text|class=fmtext|label=Email|fieldname=fm_email|max=100|req=true|ver=email
    type=text|class=fmtext|label=Subject|fieldname=fm_subject|max=100|req=true
    type=verify|class=fmverify|label=Verify
    type=textarea|class=fmtextarea|label=Message|fieldname=fm_message|max=1000|rows=6|req=true

    Any help here would be very greatfully appreciated
    Mike

  25. welcome to this blog http://www.highdenimjeans.com

  26. 1993
    John Skillings

    Matt,

    Looked into the reason why script is throwing the error:

    Notice: Array to string conversion in c:\…..\dd-formmailer.php on line 315. This is in the ddfm_str_replace function.

    It appears that when you have a SELECT field with multi=true, you get the above error upon submit.

    FYI… I added the following to the default script and was able to successfully replicate the error.

    type=select|class=fmselect|label=Colors|fieldname=fm_colors|multi=true|req=true|data=Red,Green,Blue

    I am not a PHP programmer. Appreciate if you can let me know of any quick workaround.

    Thank you.

    John Skillings

  27. 1992
    John Skillings

    Matt,

    It is been couple of years since I first integrated version 5.4 of the PHP Form Mailer for a client. I start looking into an upgrade earlier this week, and ran in few problems that I think you should be aware of.

    To begin with, there is an issue with the global variables accessed in various functions. Even though a global variable value is set, the value in the function is null. Please see http://forum.joomla.org/viewtopic.php?p=2126394. After researching, I found that the way PHP5.3 handles global variables is different from the previous functions. The following additions to the code fixed the issue:

    global $form_submitted;
    global $form_input;
    global $show_required;
    global $max_file_size;
    global $verify_method;
    global $script_path;

    Next, upon submit, the script throws the following error:

    Notice: Array to string conversion in c:\…..\dd-formmailer.php on line 315. This is the ddfm_str_replace function.

    This above notice is repeated 3 or 4 times, and is not looking nice. Can you let me know the possible source of this error please.

    Thank you and looking forward to your response.

    John

  28. 1991
    John D

    The script is uploading files to our server with a permission of 600 by default. This causes me problems in downloading the images to my own pc.
    Is there anyway of forcing the uploading of the file to set permission at 766 instead of 600?

  29. 1990
    kike

    Hello,
    First of all, congratulations for this fantastic script. Well, I’m trying to apply the script niceforms-v2.0, so, I followed two simply steps:
    I changed the $path_to_css pointing to the niceforms css file
    then, I changed the form’s class attribute to niceform’s..
    And it works, but, the labels appear on the right hand side of the input boxes and I don’t really know how to fix it…
    Any idea?
    Thanks a lot

  30. While I’ve gotten recaptchs to work in IE, its introduction makes placing checkboxes or radio buttons anywhere in the form impossible to manage.

    Here’s an example:
    http://oneproductionplace.com/mainpages/contact2.php

    I’ve tried using html tags and more to correct the appearance, but the information always appears skewered. Am I missing something?

  31. Upgrading to the new form for a new site, and when the form is displayed, instead of getting a ” * “(asterisk), I get “DFM_REQUIREDTAG” displayed in red….

  32. 1987
    Joshua

    What if I want to have a contact form at the bottom of EVERY page on my site? Is this possible?

    The reason I ask is because I see this setting:

    // FULL URL TO CONTACT PAGE
    // If you are running this script in standalone mode, leave this blank. Otherwise,
    // enter the full URL to the page that is displaying the form

    So what is the actual purpose of this setting AND what if I want to place it on multiple pages on my site?

    Thanks.

    -Josh

  33. 1986
    Jacob

    I am having the hardest time I been working on trying to fit this form into a iframe and have it position relative on my website. The iframe is positioned correctly on my page but I dont know if its margins, padding, or the width and height that i got wrong but the iframe is blocking some of my html from being highlighted because the iframe is sitting ontop of some of the text around the form.

    Here is my HTML code and my CSS file

    HTML:

     		<br />
    		<br />
                    <span class="contact"> 
    <iframe src ="boyds_auto_body_contactform.php" allowtransparency="true" position="absolute" width="550" height="600" frameborder="0" scrolling="no"></iframe></span>
    		  <br />
                      <br />

    CSS

    
    }
    
    .contact {
    	position: relative;
    	left: 300px;
    	top: -1125px;
    }

  34. Hi all,

    I guess this is my day for questions, so here goes.

    First Question:
    I noticed that in an implementation using an “include”, after my custom thank you page displays, when I hit the back button a completely filled out form reappears and I can resubmit the form again and again.

    I’ve tried to implement cache-control but with no positive results. I can see some hacker deluging my client’s in box with bogus forms.

    Second question:
    Has anyone figured out how to show a customized error page if a required field is missing, instead of the generic one with no styling at all, when using an “include”?

    Thanks for your help.

    Best,

    Jerry

  35. Hi all,

    I’‘ve set up the selrecip field with a series of questions and appropriate e-mail addresses (not always different). Something like this:

    type=selrecip|class=fmselect|label=Recipient|data=(select),Thinking of joining but need more information?,email1@domain.com,Need help with your password?,email2@domain.com,Questions about an exhibition?,email3@domain.com,Want to Volunteer?,email1@domain.com

    I’d like to be able to pull the question being asked from the selrecip field and include it as the subject line of the sent e-mail, so the sender won’t have to fill out a separate “subject” field.

    I’ve tried a number of solutions and looked though all the posts but I can’t figure it out.

    I’m running the current formmailer version.

    Any suggestions?

    Thanks,

    Jerry

  36. 1983
    A. Girl

    Is there a way to have the “Thank you.” page linked to a customized page? Also, when someone doesn’t fill in a “required” field, there is the generic page, but I want it to go to a customized page. How can I do these things? Please help.

  37. I’ve just upgraded scripts to Version 5.8…and now the verification code fails in IE 7.0.5730 on a number of sites. Works fine in other browsers.
    Example: http://viaelisa.com/via_elisa_contactnew.php

  38. 1981
    karlogann

    Hello, is it possible to have the script save the data to an xml file or send the xml file per email?
    Gretings, Karlo

  39. 1980
    harry

    i am using the standalone version
    when i send a message on the form i get the error messages

    DDFM_errormsg
    DDFM_novergen

    how to fix that?

  40. 1979
    Pascal

    Are you still updating it?

  41. To make the name required, you would just have to add a check in the code, to not allow blank names. Look for the text “only the message is required. to require others, add checks for them”. It shows that on the message check. Just duplicate that line for the name field.

  42. To make search engine familiar with our sitemap, everything running well and there’s no problem. really easy to use and very recommended.

  43. 1976
    John

    First of all, thank you for your work on this script. I’m having the same issue as Ian (commment #1966). Whenever I or anyone tries to submit the form, the form reloads without any formatting. The form is not running standalone.

    This problem began when my hosting company updated from PHP4 to PHP5. Is there something I’m missing that needs to be changed for dd-formmailer to work with PHP5? I did the small PHP file to test the PHP mail function and it arrived perfectly.

    Thanks to anyone that can offer any help.

  44. 1975
    claudia

    When you use the script, do you reduce everything you do not need? In my script the code is 2000 rows long. I would like to use the formmailer on different pages with different modifications and i have to insert the scriptcode in existing sites. it is so confusing and i don’t know if there is a error of reasoning.
    Maybe some other users have a clue, what is wrong and how i could reduce the code to a minimum.

    Thank you!

  45. 1974
    Kat

    Hmm, I provided a solution to a problem that several people expressed (how to redirect different forms on the same site to different URLs) – and while my comment initially showed up, it seems to have disappeared.

    Don’t know why a positive, helpful solution-oriented comment would be wiped out. And what does deleting such a post communicate about how helpful comments intended to help the community are valued?

  46. Would be great if there could be multiple instances on non wp version.

  47. 1972
    Josephine

    Hi

    No matter what I set the max widetext value to be, I keep getting an error for characters allowed.

    This is what I have now and even when I know I don’t have 4000 characters, including spaces, I still get an error:

    type=widetextarea|class=fmtextwide|label=Story idea|fieldname=fm_storyidea|max=4000|rows=10|req=true

    Anything I’m doing wrong?

    Thanks!

  48. 1971
    ERiK

    what if one wants a drop down list of different email addresses/names to chose whom the email from the form is sent to? how would that be coded? i’d be a newbie and don’t know how and cant find it on the web.

  49. i was wondering how to add a drop down box and have users select an email that the message in the form would be sent to? i’m a php newbie and have the form working fine but need to know how to do the above.
    if you can help it would be greatly appreciated.

  50. Hi,
    I am trying to display a link in the $sent_message output and can’t seem to figure it out.

    I have setup an auto redirect after the message has been sent but also want to display an alternate link just incase the redirect does not fire.

    Here is the code I am working on:-

    
    $sent_message.= '<p>You will be automatically re-directed to my Home Page in 5 seconds.</p>';
    $sent_message.= '<p>Alternatively, please click '.<a href="http://www.my-domain.co.uk">.'here'.</a>.'.</p>';
    

    Any help would be appreciated.

    Regards..,

    MT

  51. Man, I really like this plug-in — it makes form design and management very easy.

    SEO Manchester

  52. Been using this form for a while now and even though I have no PHP knowledge I was able to make almost everything work as the design dictated, but the designer is requiring me to use a rollover image for the button and although I’ve tried a couple of things it doesn’t seem to work for the rollover.
    I tried a bit of jQuery :

    <script type="text/javascript" charset="utf-8">
        $(document).ready(function(){
            $('#submit').hover(
                function(){ // Change the input image's source when we "roll on"
                    $(this).attr({ src : 'submit_over.png'});
                },
                function(){ // Change the input image's source back to the default on "roll off"
                    $(this).attr({ src : 'submit_off.png'});             }
            );
        });
    </script>
    

    and made the change to the submit code where input type is changed from submit to image and included the source src=”" but still having some trouble.
    So I tried to make a background image inside the css with a hover effect for the text only and found that using this method I loose the fancy little hand which the jQuery provided.
    Has anyone on here made an image rollover for the submit button?

  53. 1966
    Ian

    I’ve spent a couple of hours on this thing and it displays fine.. the problem is it just reloads new every time the submit button is hit.. like the post values aren’t being picked up by the handler part of the script.

    I use a get system to display my pages such as index.php?p=contact etc..

    Is there an issue with this? I’m not using standalone.. the form posts variables so it hould act lie any other form.. yet it doesn’t get picked up when handed toitslf.. is there a line missing from the beginning of the script such as an if $_post exists etc? I notivce its half way through..

    Thanks in advance

  54. 1965
    Yakiv

    Still hoping for some help on this one:

    http://www.dagondesign.com/articles/secure-php-form-mailer-script/comment-page-130/#comment-507590

    By the way, your link to the comment about HII does not work. It doesn’t go to the appropriate comment. …Mine (above) may not work either, but the point is, #comment-507590 or probably better:

    1939
    Yakiv
    3-8-10 1:30PM

    on page 130.

  55. 1964
    Jason

    If I am not using the standalone option and including the form on a separate contact.php page how do I include it? do I copy all of the script onto that page or do I use an include?

  56. Thanxs very much, I am going to have a look at this and probably use it for my next website.

    SEO Manchester

  57. Very well! Good post!!

  58. Very important information!

  59. 1960
    Jacob

    I’m trying to get the form to redirect to a different page after it has been submitted, but only if a certain field is selected on the form. Basically I want to redirect people to a credit card processing page depending on which registration type they selected. So if a certain radio button is selected it would redirect them (after form submission) to the page to take their credit card for that particular registration type.

    Any ideas? Thanks!

  60. You are rights!

  61. I yave work form…

  62. if you work with html – used form include

  63. Used php…

  64. Script work with html?

  65. Wery well!

  66. Yes… script is shared…

  67. Good varint!

  68. Hi! You site in my favorits!

  69. Thanks for shared info! I can`t find it net.

  70. How it work. I have problem in use.

  71. Good luck! You are the best!

  72. Thanks! Good luck!

  73. Thanxs very much i am gonna have a look at this and probably use it for my site
    am testing it atm but it seems that cc or multiple to dont work for me
    i use

    $recipients = ‘to=me1@domain.com|to=me2@domain.com’;

    but only get the 1st one

    can it be something my provider blocks or m i doing something wrong

  74. A few people mentioned problems with the date chooser field type. I tested this out thoroughly, and it seems to be functioning fine. Just be sure (if you are using the PHP version of the script) that you are including the required javascript file.

    As always, I am not able to implement every single requested feature, but I try to focus on known issues, while implementing things that many can benefit from.

  75. I have managed to get my recaptcha image to show now but am having trouble to get input in my new fields accepted. Please could you advise.

    Many thanks

    Julian

  76. Thanks!Great article!

  77. thanks super

  78. 1941
    Gillian

    If I want to send the data inputed into this form to a database where would I put the file so that I can send the data when the user submits the form?

  79. 1940
    Suzy

    Regarding my previous comment: 1896, DaveP’s comment: 1926 and Eric’s Comment: 1912:
    I did finally get the .csv files to work when not in standalone mode with version 5.8 (not with earlier versions). The instructions state “With the PHP version of this script, the path to the data file is relative to the location of the script. Be sure to give this file write access.”

    Even if the script and the .txt or .csv file are in the same folder (ie: dd-formmailer), just using $save_path = 'form-messages.csv'; did not work. The relative path that finally worked for me was:
    $save_path = './dd-formmailer/form-messages.csv';

    I am not sure if this worked because the .php file that was including the dd-formmailer.php script was outside of the dd-formmailer folder, but anyone who is trying to include the form in their own .php page should try using a path in the same format as above.

    As for write access to the .csv or .txt file, the lowest file permissions I could set and still have the file written to by the script was 722.

    I hope this helps anyone who is still pondering over this function.

  80. 1939
    Yakiv

    Has anyone used an alternative captcha – called HN CAPTCHA – with this script? I absolutely love this contact form. It is one of the best on the internet. The captcha is quite good, but I have wished I could use HN CAPTCHA, which I use throughout my sites. Here’s a direct link to the project, in case anyone does not know about it:

    http://hn273.users.phpclasses.org/browse/package/1569.html

    Hope maybe someone can help with this. I did see the code for HII and thought about trying to pick away at it to get it work with HN CAPTCHA, but if someone has already done it and can graciously contribute the code, I would be grateful! Thanks!!

  81. I am having problems getting the Recaptcha image verification object to appear on my form page, having followed your troubleshooting advice. I have entered the keys that I got from signing up for this. Please could you advise.

    Otherwise I am very impressed with this program.

    Many thanks

    Julian Yorke

  82. Great article , been looking for this type of detail

  83. hello sr ki haal hai

  84. 1935
    sims

    Oh, they paginate after they all load… almost pointless…

  85. 1934
    sims

    It might be a nice idea to paginate the comments. This page takes forever to load. When it does load, it takes up so much memory and some text can’t even be displayed.

  86. 1933
    John

    Script works great. Thanks. However, the reply-to email in the emails I receive from the form displays my default server email address (e.g username@box#.servername.com). I would like to have the reply address display the email the users enter in the form field. Whats the best way to make this happen?

    THANKS!

  87. First of all thank you for the awesome script! It was the only one I found that would work with yahoo hosting. Secondly, I wanted to use this script on a different page, without making it standalone so I put it in an iframe and of course it didnt line up correctly, however it did send email. So then I spent the rest of the day trying to edit the css. NO GO! So I had to find a workaround for this problem. Literally half the form wasn’t showing up in the iframe for some reason. For those of you who just want to pull this php form into a regular html page so you don’t have to hassle with editing the script or the css here is the workaround for it. YEAH! I hope this helps save you hours!!!

    <div style="
       clip: rect(0,381,381,0); // right-clip equal to div width plus total border width
                                // bottom-clip equal to div height plus total border height
       position:absolute;       // used for positioning and may or may not be required
       background: #FFF;        // background color of div may or may not be seen
       height: 500;             // height of window (div) that contains the iframe content
       width: 377;              // width of window (div) that contains the iframe content
       left: 125;                // absolute position of window (div) from the left edge of browser
       top: 100;                 // absolute position of window (div) from the top edge of browser
    ">
    
    <iframe 
       src="your_full_url_where_you_uploaded_dd-formmailer.php" // location of external resource 
       width="600"              // width of iframe should match the width of containing div
       height="600"             // height of iframe should match the height of containing div
       marginwidth="0"          // width of iframe margin
       marginheight="0"         // height of iframe margin   
       frameborder="no"         // frame border preference
       scrolling="no"          // instructs iframe to scroll overflow content
       style="
          border-style: solid;  // border style
          border-color: #333;   // border color
          border-width: 2px;    // border width
          background: #FFF;     // background color
    ">
    </iframe>
    
    </div>

  88. 1931
    John

    Any way to have form elements side-by-side?

    Thanks

  89. 1930
    Neil H

    In FORM STRUCTURE I would like to use a fully formated, multi line message for fm_message but I can’t seem to get default= to work other than a short default message. Is it possible to pull a formated message from a file or do you of any other work around? Thanks

    type=textarea|class=fmtextarea|label=Message|fieldname=fm_message|max=5000|rows=35|req=true|default=Regular message goes here.

  90. 1929
    Luc

    Hi there. In the instructions it’s specified that each words that can be seen in the form have been translated in the language files.

    I see that nobody pointed that out yet (how come ? ) but the labels, like for example “Name” in the form is not translated at all, nor are the other ones. the only one translated is the “Send” button value.

    I added to my language files

    
    define('DDFM_NAME', 'Name');
    

    and want to use it instead of “Name” in the following code:

    
    type=text|class=fmtext|label='DDFM_NAME'|fieldname=fm_name|max=100|req=true
    

    I tried numerous options and it doesn’t work.

    Anyone can help ?

    Thank you

  91. hello
    really good script
    however is it possible to make users type(Input by themselves) the recipients email address instead of giving them choices from already fixed lines of emails to choose from a list

  92. 1927
    Jozsef

    With $standalone = FALSE; is there any way to do any kind of changes with Error page I’m getting if I don’t fill all required fields? Or, is there a way of having custom Error page for this thing?
    Thanks.

  93. 1926
    DaveP

    I cannot get any data written to a data.txt file in the same folder as I have the scripts, full write permissions exist. This has been raised before but I could not see a solution for it -Does anyone have one please?

    // SAVE DATA TO FILE
    // If set to TRUE, the form input will be saved in a delimited file

    $save_to_file = TRUE;

    // STILL SEND EMAIL
    // If saving the data to a file, still have the script send the email?

    $save_email = TRUE;

    // DATA PATH
    // The file that will be written to – make sure it has write access

    $save_path = ‘data.txt’;

    // DELIMITER
    // Fields will be separated by this character. If this character is found in
    // the actual data, it will be removed.

    $save_delimiter = ‘|’;

  94. iv tried to do my form in the $manual_form_code part but for some reason none of the data is in the email when i receive it ?

    i made the form in $form_struct first which works but when i copied the html code in the manual part no joy !!!

    dose any one have any idea on why !
    this is page here
    http://www.mediacake.net/client/open4ed/order2.php

    thanks

  95. I have implemented this script twice now, the first is at:

    http://richardloosassoc.com/contactus/

    The newer one is at:

    http://starmarineservice.com/starmarine_contact.php

    I’m having a strange problem that I was hoping someone might have a clue about how to solve.

    When you view this new site with MSIE 8, when you click on the form field under the name tag, it doesn’t bring focus to the field. You have to click on the name tage, or any text tag associated with it’s particular form field.

    The first site works perfectly. I have gone through the code with a fine tooth comb and can’t find any major differences. On the first site, I cut and pasted the code right into the page. On the new site, I added it as a php include.

    I thought about simply writing in a statement to bring focus to the first element but the truth is, that wouldn’t really work because when you have focus on the form field and click the form field, it loses it’s focus.

    Weird problem, any thoughts?

    http://www.starmarineservice.com/starmarine_contact.php

  96. 1923
    Josephine

    Thanks, Paul!

    I’m going to try the code change for the submit button tonight.

    Jo

  97. 1922
    Paul

    LUST -

    Would using a redirect tag work to meet your needs?

    <META http-equiv="refresh" content="5;URL=relative_or_absolute_path_to_redirect_to">

  98. 1921
    Paul

    Eric -

    I think that the .csv file and the .php file need to have the same owner. Make sure that what ever user account owns the .php file owns the .csv file as well.

  99. 1920
    Paul

    Josephine: (I forgot to use the

     in my first post)
    
    Look for this line and edit:
    <code>			
    //$o .= '<div class="submit"><input type="submit" name="form_submitted" value="' . DDFM_SUBMITBUTTON . '" /></div>' . "\n\n";
    

    I wanted to do the same as you did…here is my modified line:

    			$o .= '<div class="submit"><input type="submit" name="form_submitted" value="Submit Proposal" /> <input type="reset" value="Clear Form" name="clear_form"></div><p></p>' . "\n\n";
    

  100. Josephine:

    Look for this line:

    //$o .= ” . “\n\n”;

    I replaced it with this in my code to do just what you wanted to do:

    $o .= ‘ ‘ . “\n\n”;

  101. 1918
    Josephine

    If I want to change the button that says Send Email to say Enter Contest, where would I find that on the script and how do I do it?

    Thank you.

  102. 1917
    yaron elh

    the third problem I came across while trying to build a form, as I wanted to use an image instead of a submit button.

    So first thing I tried is just to change the input type from, input type submit to input type image.

    And Which that worked perfectly in all browsers except Internet Explorer, but technically this time Internet Explorer is on the right side of things.

    Well I’ve found a solution for this, if you want a submit button as an image, first you need to change the submit type to image.

    The second thing you need to change this line of code.

    
    if (isset($_POST["form_submitted"])) {
    

    To this one.
    
    if (isset($_POST["form_submitted"]) || isset($_POST["form_submitted_x"])) {
    

    It worked for me, hope it help someone I’ve seen it appear on the posts several of times, but nobody really bothered comeback and submit the Solution. so in the spirit of open source here you have it.

    And many thanks to developer for an excellent script.

  103. 1916
    yaron elh

    improvement suggestion

    Sometimes you would want to use this, as a quick form in every page of your website.

    This code will detect the page you were in

    
    function curPageURL() {
     $pageURL = 'http';
     if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
     $pageURL .= "://";
     if ($_SERVER["SERVER_PORT"] != "80") {
      $pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
     } else {
      $pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
     }
     return $pageURL;
    }
    
    

    then instead of hard coding a static URL in the
    $path_contact_page

    you can use this code
    $path_contact_page = curPageURL();
    (You can put the previous code above it)

    and it will assign the current page dynamically

    note: this code did not work for me in a local server.
    only on a remote server it obtains the URL correctly.

  104. 1915
    yaron elh

    if someone wants to send characters in utf-8 correctly in the subject field of the mail,

    currently the code has one method of doing which didn’t work for me so this is another method, and it displays the subject field correctly for me.

    The lines

    
    $headers .= 'From: ' . $sender_name . ' <' . $sender_email . '>' . 
    PHP_EOL; 
    $headers .= 'Reply-To: ' . $sender_name . ' <' . $sender_email . '>' . PHP_EOL;
    $headers .= 'Return-Path: ' . $sender_name . ' <' . $sender_email . '>' . PHP_EOL;
    

    should be replaced with:

    
    $headers .= 'From: =?UTF-8?B?' . base64_encode($sender_name) . '?=' . ' <' . $sender_email . '>' . PHP_EOL;
    $headers .= 'Reply-To: =?UTF-8?B?' . base64_encode($sender_name) . '?=' . ' <' . $sender_email . '>' . PHP_EOL;
    $headers .= 'Return-Path: =?UTF-8?B?' . base64_encode($sender_name) . '?=' . ' <' . $sender_email . '>' . PHP_EOL;
    

    further the code you have more lines

    
    $headers .= 'MIME-Version: 1.0' . PHP_EOL;
    $msg .= 'Content-Type: text/plain; charset="utf-8"' . PHP_EOL;
    

    should be replaced with this one

    
    $headers .= 'MIME-Version: 1.0' . '\r\n' . PHP_EOL;
    $msg .= 'Content-Type: text/plain; charset=UTF-8' . '\r\n' . PHP_EOL;
    

    now the last thing you have to do is comment out, the previous suggested fix For forgets that is present in the source.

    comment this section out:

    
    if (function_exists('mb_encode_mimeheader')) {
    	$email_subject = mb_encode_mimeheader($email_subject, 'UTF-8', 'q', '');
    	$sender_name = mb_encode_mimeheader($sender_name, 'UTF-8', 'q', '');
    	}
    

    this fix is based on
    http://bitprison.net/php_mail_utf-8_subject_and_message

    and I implemented it in the code

    Hoping helps someone

  105. 1914
    jph

    looks awesome…. but having trouble using gmail servers, requires SSL. I put in the following code, but it doesn’t seem able to deal with an SSL connection? Ideas?

    
    //following chunk taken from http://www.dagondesign.com/articles/secure-php-form-mailer-script/#installation as suggested replacement
    ini_set("SMTP","smtp.gmail.com");
    ini_set("smtp_port","465");
    ini_set("username","xxxxx@gmail.com");
    ini_set("password","xxxxx"); 
    ini_set('sendmail_from', $sender_email);
    $send_status = mail($send_to, $email_subject, $msg, $headers);
    ini_restore('sendmail_from');	
    	
    	//@ini_set('sendmail_from', $sender_email);
    	//$send_status = mail($send_to, $email_subject, $msg, $headers);
    	//@ini_restore('sendmail_from');
    
    	return $send_status;
    

  106. I am having an issue with a long delay/hang, 30-60 Sec. after a form is sent and then goes to the thank-you page.

    Jeremy

  107. I love this script and will be donating soon ! You deserve it for all your dedication and hard work on this. The website addy above is under construction.

    I’m having a small issue with the following code…in standalone mode.

    // SAVE DATA TO FILE
    // If set to TRUE, the form input will be saved in a delimited file
    
    $save_to_file = TRUE;
    
    // STILL SEND EMAIL
    // If saving the data to a file, still have the script send the email?
    
    $save_email = TRUE;
    
    // DATA PATH
    // The file that will be written to - make sure it has write access
    
    $save_path = 'data.txt';
    

    As you can see I’ve changed the values to TRUE for the save_to_file and kept the email function of the script but when I attempt to have the data written it does not write.

    I’ve chmod 777 for the data.txt file and even attempted to specify a CSV file instead of a txt file but the script is not writing to the file.

    I also have attempted to change the permissions on the main directory for 777 but that prevents the script form running properly.

    If you could post some more info about the save_to_file feature I’m sure many of us would benefit from it.

    Thanks!

  108. hi boys,
    I wants a script for mail if you have send me plz at waji.lala@gmail.com i can not make himself

  109. I like the script. Thanks for the secure php form mailer script.

  110. Thank you so much for the sharing.

  111. 1908
    HTML

    Stupid comment form didn’t show the HTML table structure I used… I’m sure you all know your basic table tags… or do you?

    http://www.w3schools.com/html/html_tables.asp

  112. 1907
    HTML

    Sending messages in HTML format is possible by changing the Content-Type from text/plain to text/html.

    Before:
    $msg .= ‘Content-Type: text/plain; charset=”utf-8″‘ . PHP_EOL;

    After:
    $msg .= ‘Content-Type: text/html; charset=”utf-8″‘ . PHP_EOL;

    Now all you have to do is edit the $message_structure to something like this:

    $message_structure = ‘

    Business Name:

    fm_bname

  113. 1906
    Catherine

    Is there a way to set the permissions of the actual files that are being uploaded (with the save attachments option)? Right now they’re defaulting to 600.

  114. 1905
    Dean Wild

    Hi I have just installed the Form Mailer script into a website I have designed. I have added the Javascript date chooser however I have noticed that when the form is sent the E-mail I recieve does not include the date that has been entered or chosen. :( Any idea how to fix this? Thanks

  115. 1904
    Rita

    Hi again,
    After some work the error is gone but I get this error and message will not go through.
    Method Not Allowed
    The requested method POST is not allowed for the URL /contact-us.html.

    Tried to test using this script

    The message will go through and receive it. So the server not at fault and I can’t see any misconfiguration script.
    Any help will be very much appreciated.
    Rita

  116. 1903
    Rita

    Hi all
    I get this error:
    Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in /homepages/13/d302728987/htdocs/contact/formmailer.php on line 159

    Any help will be appreciated.
    Thanks
    Rita

  117. 1902
    Rob

    Fatal error: main() [function.require]: Failed opening
    required ‘lang/English.php’ (include_path=’.:/usr/lib/php’)
    in /homepages/13/d302728987/htdocs/contact/dd-formmailer.php on
    line 249

  118. 1901
    Lust

    Anyone know how to make it redirect straight to a page and not after it refreshes the same form page?

  119. Okay, now I know that at the free service plan that I have with my host I will not be able to send email. It is funny how I thought I paid for something by purchasing a domain name, just not the monthly service. Perhaps then the answer to my question below is obvious?

  120. So far so good. The form appears on my site and I like it. The one thing that I have not yet found out yet is if I am able to submit email via my host server, which I understand will be a sepparate issue. But if my host server is not the issue, then what might cause the dd-formmailer.css to load after I have clicked the send e-mail button on the form? Currently after I click the send e-mail button the blank dd-formmailer.css page loads.

  121. Great tool! Installation is almost instant :D

  122. 1897
    Suzy

    Just noticed a typing error in my last Commment (1896). The full url path that I have tried in the $path_contact_page line is in the format of: http://www.mydomain.com/filename.php
    Thanks again for any advise you can offer.

  123. 1896
    Suzy

    PAUL (Comment 1880) regarding my earlier comment (1847). Thanks for the suggestion Paul. All files relating to dd-formmailer have the same owner and I have set the necessary file permissions to 777 or 755.
    With some further testing, I discovered that if the script is installed as a standalone option, the messages are posted to the csv file. If I set the standalone option to FALSE but leave the $path_contact_page blank, the messages still populate the csv file. I would like the submission message to be returned in the .php file that calls the dd-formmailer.php script. For this to work, I must put a path in the option $path_contact_page. I have tried using a relative path to dd-formmailer.php, a relative path to the .php page calling dd-formmailer.php and also tried the full url from http:www.mydomain.com/ etc. As soon as I enter any path in $path_contact_page, the messages no longer populate the csv file.
    My php coding knowledge is VERY limited and I do not know if there is an error in the code relevant to $path_contact_page or if there are additional optional settings I should have used to make the script work when being called in a separate .php file.
    Any advise would be appreciated. It’s a great script and I don’t want to give up on it yet! Many thanks.

  124. 1895
    Stan

    I installed the latest version (5.8) script with basic image verification. Works fine in Firefox, but Internet Explorer gives me this error:
    “No verification code generated”.
    I triple-checked everything, and since it sends email in Firefox, I have no idea what the problem might be.
    Any ideas?

  125. Hi, I have problem with: á é í ó ú ñ

  126. 1893
    Paul Söderholm

    I have the same problem as mentioned in comment 1862: Special characters (for example umlauts) in Subject and From are garbled, but looks OK in the message. Help, anyone?

  127. How would I pass a value to the form so I can put an email link to one of the multiple recipients… so when someone clicks on the link, they go to the contact form and either that particular person’s name is selected in the dropdown box… or the name is echo’d to the form as text… signifying who the recipient will be upon submittal?

    Recipient Name

    Please help.

  128. Unbelievable script! Thanks so much – installed and modified without a hitch! Will make a donation very soon to support your excellent work.

  129. 1890
    nknk

    hjkk

  130. yes i know

  131. 1888
    Emil

    When I receive the email it shows the information like this:

    NAME: John Smit

    EMAIL: john@mail.com

    MESSAGE: This is my message

    There is too much space between lines, there is two there
    My question is how I can eliminate one ?

  132. 1886
    Paul

    DDFM-REQUIRED_TAG – I also had these showing instead of the asterisks and couldn’t figure out how to fix it. I copied my form field declarations to a clean version of the formmailer.php file and it fixed the problem. Apparently I may have either inserted or deleted a character in the PHP code somewhere. If you’re having this problem try what I did.

  133. 1885
    Paul

    MIMI (comment 1829) – did you get the attachment feature to work? (I saw you had it implemented on your contact form, so you may have – or you may be using a different script for your contact form.) If not, did you define this: Save attachment path – Where files will be saved, if attach_save is enabled. This is the full path on the server, with a trailing slash. Directory must have write permissions. Example: /home/user/public_html/uploads/ Also, I’m not sure but your upload directory and formmailer PHP file may need to be owned by the same user.

  134. 1884
    Paul

    VINCENT (comment 1843) – why would you want to leave the form and go to a custom error page? The second part of your question (having contextual error messages) would be highly usable. I think you’d have to find where in the PHP code the error messages are generated and change it from displaying the errors in DIV tags to looping through re-generating the form with contextual error messages (error messages next to the field with the error). Good luck!

  135. 1883
    Paul

    RUI (comment 1837) – you can’t display a hidden field…it’s HIDDEN :-) However, you may be able to tweak the code that generates the email message and manually add the hidden field to the generated email message. You’d probably have to create a new ‘case’ for hidden fields. Don’t ask me how, but anything can be done.

  136. 1882
    Paul

    MICHAEL (comment 1857) – I read in another post (way earlier) that the message can’t be sent in HTML format

  137. 1881
    Paul

    MATT (comment 1876) – your language file may be corrupt, try downloading again and extracting the language file and copying it to your directory.

  138. 1880
    Paul

    SUZY (comment 1847) – I think the that your CSV file and formmailer PHP file need to have the same owner as well. I’m not positive, but it’s worth a try

  139. 1879
    Paul

    I found an old post that addresses my issue in comment 1870…the fieldname must be name fm_xxxxxxx with no caps or special characters after fm_

  140. 1878
    Mr Ree

    Let me try this again….

    How can I add a message on the top of the form page that goes away when the message is sent? In an older version I found this

    $form_structure = array(
    “openfieldset|fmset”,
    “info|fminfofull|Text here
    but on the latest version, I cant find it.

  141. Ref post 1876 – Click on test link under “Special Announcements” to see visual of last post. Apparently the asterisk and submit buttons aren’t getting translated.

    Thanks!

  142. 1876
    Matt Lewis

    Great script just having a small problem. Unable to get script to read language file. Have uploaded the English.php into folder named “dd_formmailer” in my server’s root directory. Set path to /dd_formmailer/English.php and get DDFM_Required_TAG errors for all the basic fields. Seems like the path is correct, but can’t figure out why. Names of field do appear next to the filed boxes. Help please – read through your discussion forum, but don’t see same issue/solutions. Thanks for the effort!

    Thanks!

  143. great script but i dont work it. please help me

  144. 1874
    duffy6

    Hi!

    Is it possible to attach the uploaded file to the auto reply mail?

    regards,
    duffy6

  145. Great Script. Easy to follow for a novice like me. Thanks so much!!

  146. .. and where do i increase the way to tiny VERIFICATION CODE (basic) within the latest script versions (the older scripts had a separate file for that)……???

  147. I see postings 28 & 29 but these must be for a previous version of the script because I do not find line referred to by Dagon Design Admin. I figure I need to define the variables for my new form fields so that the data therein will be passed through to the email but don’t know where in the PHP to do this. Any assistance is appreciated. Thank you.

  148. None of the form fields that I add are passing the data through to the email. If I use the forms fields that come with the script the data in those fields come through in the email that generated…but not any new fields that I’ve added. Why?

  149. 1869
    Dave

    I get this in front of every field why ???
    DDFM_REQUIREDTAG
    Also where is form structure, I need to get rid of one field only….

  150. got it working… just in case anyone else runs into this issue:

    
    $auto_reply_message = 'some text' . "/n";
    

  151. 1867
    vv

    I’m trying to figure out how to put a line into auto replay.
    The following attempts don’t work for me.

    
    $auto_reply_message = 'some text';
    $auto_reply_message .= /n;
    $auto_reply_message .= 'some text';
    
    $auto_reply_message = 'some text';
    $auto_reply_message .= '<br />';
    $auto_reply_message .= 'some text';
    
    

    Any suggestions are appreciated.

    Thanks!

  152. 1866
    Mster Ree

    Let me try this again….

    How can I add a message on the top of the form page that goes away when the message is sent? In an older version I found this

    $form_structure = array(
    “openfieldset|fmset”,
    “info|fminfofull|Text here
    but on the latest version, I cant find it.

  153. 1865
    Graham

    Re my earlier post 1860
    Fixed it!

    added this line to $form_struct
    type=text|class=fmtext|label=Unit Type|fieldname=fm_type|max=100|default=’.$_POST['unit_type'].’

  154. 1864
    Graham

    Ref pots No1859

    Ree can’t you use a FULLBLOCK adding this to top line of $form_struct ?

  155. 1863
    Emma

    Has anyone used google conversion tracking with the wordpress version of the form mailer? I am struggling to see where I should insert the google conversion tracking code in the “dd-formmailer/dd-formmailer.php” file. Any help will be greatly appreciated.

  156. Is there anybody still answering any of our questions at all???

    I discovered an UTF-8 encoding error in this script and i’d like to fix it.

    In the FROM output
    (Example:From:
    “Rädölf Ãberläufer”
    the NAME is not UTF-8 encoded (while it is in the body section of the email).

    Suggestions anyone pa-lease???

  157. 1861
    Graham

    I’m having trouble using a variable passed to the form.
    I am trying to use it as a ‘default’ value in a form element or adding to $email_subject. The variable is being passed ok but how can I use it within the form itself?

  158. 1860
    Ree

    How can I add a message on the top of the form page that goes away when the message is sent? In an older version I found this

    $form_structure = array(
    “openfieldset|fmset”,
    “info|fminfofull|Text here
    but on the latest version, I cant find it.

  159. 1859
    Ree

    How can I add a message on the top of the form page that goes away when the message is sent?

  160. Hi I can’t get any error messages to show – So whatever I type in the fields still sends the form through, but I can leave out fields & won’t repost an error .. Any ideas please????

  161. 1857
    Michael

    Is there anyway to use html in the message template?

    When I use html code i.e I dont see the html in the email only the actual html code.

  162. how can i insert a line break to the checkbox options – so that each option ticked shows up on a separate new line in the email output??

  163. 1855
    John H

    Hi, Love the script, massive help to me so far!

    Can you help me with populating a select field?

    I am using the standalone version, and trying to prepopulate a dropdown box with options from a mysql database. I cant figure it out at all???

    Thanks in advance!

  164. 1854
    John H

    For those of you who are trying to get the standalone version to update a table on a mysql database, after loads of searching and playing I have got it to work like this. I added this code:

    $con = mysql_connect(“host”,”user”,”password”);
    if (!$con)
    {
    die(‘Could not connect: ‘ . mysql_error());
    }

    mysql_select_db(“dbname”, $con);
    $sql=”INSERT INTO tablename (fm_firstname, fm_lastname, fm_email, fm_etc, fm_etc)
    VALUES
    (‘$_POST[fm_firstname]‘,’$_POST[fm_lastname]‘,’$_POST[fm_email]‘,’$_POST[fm_etc]‘,’$_POST[fm_etc]‘)”;

    if (!mysql_query($sql,$con))
    {
    die(‘Error: ‘ . mysql_error());
    }

    mysql_close($con);

    after this bit:

    $o .= ‘‘;

    } else {

    in the script around line 1750 ish.

    Not sure if its the best way to do it, but I found that it wont update the db unless the form is filled in correctly, which is what I wanted.
    Hope this helps.

  165. 1853
    yamiza

    The script is not working, I’ve checked everything and it seems alright… It won’t send the e-mail to me.

  166. IMAGE SUBMIT BUTTON

    Trying to replace the submit button with an image, working fine in FireFox, Opera & Safari, but no luck in IE. Any suggestions?

    <input type="image" src="/images/btns/submitRedBtn.gif" name="form_submitted" value="SUBMIT" alt="SUBMIT" class="button">

  167. Is there any way to style the input box (in FF) for the Browse button: input#fm_upload.fmfile? If I could just make the borders plain black 1px lines, even that would help.

  168. Sure, I can have fun drinking, but I need a place to walk and hike and get away from cement. ,

  169. Preparing your postsThere are four ways to post content to Posterous. ,

  170. The certain and possible losses associated with unilateral and multi lateral political actions need to be examined. ,

  171. 1847
    Suzy

    Has anyone managed to get the form fields to save to a data file? I have tried using a .txt file and a .csv file with 777 permissions but no fields are populating. The $save_path = ‘data.csv’; is relative to the dd-formmailer.php file. I have set $save_to_file = TRUE; and $save_email = TRUE; I have not modified anything below ** END OF OPTIONS. Can anyone give me any advise or tell me if I am missing anything? Thanks.

  172. What about Autowin Book Club? ,

  173. 1845
    Jax

    I’m getting an error that reads:

    Warning: mail() [function.mail]: SMTP server response: 553 sorry, your mail was administratively denied. (#5.7.1) in D:\Hosting\3043566\html\wp-content\plugins\dd-formmailer\dd-formmailer.php on line 496

    Where exactly is line 496?

  174. I have been using this plugin for a few months without problem, but now users are getting the following error message when submitting forms: “No verification code generated”. I would be appreciative if anyone can assist with info to help fix. Thanks in advance.

  175. Hi guys, anyone found a solution yet for linking to a custom errorpage? or even better staying on the same page as the submit form but highlighted the error fields?

    Highly appreciated

    Vincent

  176. 1842
    Steve

    Firstly this is a great script and easy to set up for normal implementations.

    One observation regarding the advice above to change “_POST” to “_REQUEST” to prepopulate fields – my reading of the script is that this won’t work even if values are passed in the query string because it only populates data into the form if the “$form_submitted” variable is set, so it needs some tweaks elsewhere in the code too. (At least that’s what I found on my install but I might be missing something!)

  177. I noticed from your script that i just now downloaded that you have incorporated UTF-8 encoding into the forms message fields.

    However, the Subject line is not coming out in UTF-8 as i just tested with some German letters.
    Where in the script would i have to add what lines of code to also turn the subject line output into UTF-8 format?

  178. 1840
    Patrick Quirke

    I need a the reply message to display what checkboxes the user have checked, how can i do this?

  179. Vielen Dank für diesen Vorschlag. Ich schicke Dir einen Gruß aus Deutschland.

  180. Vielen Dank für diesen Vorschlag. Ich schicke Dir einen Gruß aus Deutschland.

    Thanks for the suggestion. I send you regards from Germany.

  181. 1837
    Rui

    Hello thank for this lovely piece of code. How can I display a hidden text field

  182. Great script. I am helping re work a community web site http//:www.wings.net.nz and downloaded and tested your script using both basic and recaptch verification within minutes on my own site, great instructions and easy to use. Thanks for the help.

  183. Unfortunately I found that the date-picker is not working in firefox for mac. Anyone know a workaround

    Still trying to solve the custom error page problem. Just dont know where to put the redirecting script

  184. Guys I think I found the solution for the thankyou page!!

    <html>
    <script>
        location = "http://yourdomain/yourthankyou.php";
    </script>
    </html>
    does the trick!!

    Paste it in the dd-formmailer.php in the $sent_message ='';

    Now I need to figure out the damn error page

  185. sorry the first link is: http://www.holandaluz.com/request-quote.php

    Vincent

  186. Hi, great script (best I found actually), Got everything running as I want http://www.holandaluz.com.request-quote.php. They only thing thats utterly, truly, honestly missing is a thank you and error page in my (css) style. Went through the whole 1,831 comments, thought I got with James (1529), but nooo, I get stuck here. Whenever the form is submitted, it´ll go to the standard white page: http://www.holandaluz.com/dd-formmailer/dd-formmailer.php.

    Admin or anyone any suggestion???? Thanks a mil
    Vincent

  187. 1831
    Simon

    We are having some problems getting the form to work when we parse it through to another page. If a field is required it displays

    DDFM_ERRORMSGDDFM_MISSINGVER
    DDFM-REQUIRED_TAG

  188. 1830
    cisono

    I was wondering if this script is really secure? I am using a version from last year and my site has been “hacked”. By this I mean that my *.html files have somehow acquired an <iframe src="… section which downloads trojans and my website has become a google-reported attack site :-(

    I am not blaming your script, but just wanted to check if you would recommend updating to the latest version (and is there an easy way to do this, other than reinstalling and redoing all the customisation).

    Cheers.

  189. how to make the attachment works?

    I currently added the following to $form_struct

    type=file|class=|label=|fieldname=|[req=true]|[allowed=1,2,3]

    but my page at http://hipfiles.com/contact.php is not sending attachment. why?

  190. thanks … i will use this script on my site at http://hipfiles.com – a powerful file search engine soon

  191. 1827
    Rob

    Hi,

    Trying to get this to work. I’ve configured formmailer.php but don’t understand how to reference the file within my contact.html page.

    Thanks,

    Rob.

  192. 1826
    Robert Cook

    After some additional testing, I’ve found that the “Including the Name of the Person Being Sent to When Using selrecip” update chokes on ampersands. Escaping the ampersand didn’t work for me. I’ll freely admit that I have no idea how to fix this, so I’ve solved the problem by removing ampersands from my selrecip options. Perhaps someone better at PHP than me can fix my fix?

  193. 1825
    Robert Cook

    I’ve had some success in figuring out a couple of requests from the comments. (Sorry if your request isn’t covered here; I’m only working on the ones I need myself.) I’m not working with the most current version (using version 5.7 with a boat-load of customization), so I apologize in advance if any of this is fixed/addressed in 5.8.

    These fixes work for me, but don’t come with a guarantee they’ll work for you. :)

    Adding Line Breaks to the Auto-Reply Message:

    Everywhere you want a line break, insert the following:

    ' . PHP_EOL . '

    If you want more line breaks, add PHP_EOL multiple times, with a . in between each one.

    Sending to Additional Recipients When Using selrecip:

    This one was actually sort of answered way back in Comment 1238, but is worth repeating. Find the following line:

    $recipients = $sel_recip;

    Immediately after that line, add this line:

    $recipients .=',name@address.com';

    Replace “name@address.com” with the email address you want it to actually go to. This adds an extra address in the To: field, and doesn’t allow for CC: or BCC: but hey, it’s better than nothing.

    Including the Name of the Person Being Sent to When Using selrecip:

    In the first “case ’selrecip’:” section add the following lines before the “break;”:

    
    $csv .= str_replace($save_delimiter, ' ', $t) . $save_delimiter;
    $mail_message .= $fs['label'] . $msg_field_sep . $t . $msg_field_line_end;
    $message_structure = ddfm_str_replace($fs['fieldname'], $t, $message_structure);
    $auto_reply_message = ddfm_str_replace($fs['fieldname'], $t, $auto_reply_message);
    $sent_message = ddfm_str_replace($fs['fieldname'], ddfm_bsafe($t), $sent_message);
    

    I haven’t been able to figure out how to get the selrecip result to show up in the auto-reply. I’m working on it, but I’m beginning to think it’s beyond my ability. (I’m a PHP hacker, not a PHP programmer. This is the reason my fixes are brute force, far less elegant than the original script.)

    Also, I haven’t been able to figure out how to get the email address from selrecip to show up with or instead of the name, but right now, just the name showing up is better than nothing.

    If I figure either of these out, I’ll post them here.

  194. 1824
    keir

    ” $_POST[fieldname] ”

    Where in the code do you insert this?

  195. If you’re using the manual form code option and want the form to “remember” input data, use this as a field’s value:
    $_POST[fieldname]

    This way, when the form produces an error because a required field has not been filled in, the user does not have to enter everything a second time.

  196. 1822
    Ward B

    How can I add the dropdown ’selrecip’ field to the email message that is sent. The name selected would be best but the email address would be sufficient. I tried to add a fieldname to the first line and then build my own custom message which included all the fieldnames but the result is blank.

    Thanks again for a great script.

  197. First of all, wondeful program. Only one problem, I can type jkewbjcrjk@gugee.com as an email address and it goes through as valid email address. How do you stop invalid emails from passing as valid email?

    Thanks, any help is good.

  198. I have the message “Error Sending Message” Everything seems to be ok. Can I check whether I can use my gmail as recipient or must I need to use email created from Cpanel of my domain name that could cause the error.

    regards

    James

  199. 1819
    claudia

    Hello. : )

    First I want to say thank you for this script. It’s the first one – and I tried a lot – that works for me.

    Anyway, I have two questions:

    1. If I include the script in another php-file, can I put the dd-formmailer-css-codes in the css-file that is already linked in the existing php-file? that there is just one css-file at the end?

    2. The auto-reply-message:
    I want to include the “gender” and the “lastname” (in german “Guten Tag, Frau/Herr Schmidt”).
    Is it possible to put something in this $auto_reply_message = ”; that generates that automatically?

    I would be very greatful if you could help me.

    Best regards.

    Claudia

  200. Hello,

    I made a verry long form, can i divide this in more pages by adding a code?

    Regards

    Harald

  201. After I installed and activated this plugin for wordpress it messed with my whole site and now every link I click on is the first blog posting, even though they url changes.
    Has anyone else had this problem?
    Any advice would be appreciated.

  202. 1816
    Bilgin

    Can the send email button be changed to an image?

  203. 1815
    Tony

    Hey,

    If I have a field in the form that contains a group of check boxes and I want to make sure this field is required for the form to be submitted, how do I do this? I can see you can add the ‘required’ parameter to individual check boxes but what about a group?

    Sorry if this has been asked/answered before… spent a long time scrolling through the comments with no luck ;)

    Hopefully someone has a solution…

  204. 1814
    Fred

    test of your capta

  205. 1813
    xx

    dd

  206. 1812
    Rhys

    Everytime there is a new version of the script I update the one I’m using hoping that it will fix a problem that I’ve had for a long time with the script.
    The script works beautifully in IE7 and firefox. Unfortunately the people in the business that I work tend to use internet explorer 6.
    In older versions of internet explorer 6 [e.g. version 6.0.2900.5512] the script will always fail on the first attempt [even if the right code was entered] but then on the 2nd,3rd,4th attempts it always goes through okay. If I close the browser and then open it up again, it fails on the first attempt but will go through again on the 2nd,3rd,4th attempts.
    For some reason the FIRST TIME the script is run in certain versions of IE6 the COOKIE is not getting rewritten which is causing the following error to appear:
    Notice: Undefined index: ddfmcode in E:domains\g\gplocumcover.co.uk\user\htdocs\comments.php on line 1480
    I really would appreciate a workaround for the script to allow it to work the first time in internet explorer 6.I’ve tried all sorts including writing a P3P policy in case IE6 was being picky about the security settings for the site but it still won’t work.
    Thanks

  207. Hi. Great script but I’m struggling with the form layout. Can anyone point me to the right part of the CSS file that I need to adjust to try an make the form elements line up.

    I would be eternally grateful.

  208. 1810
    Sanjeev

    This is in continuation to my previous comment#1809.
    I tried putting the code at top of the calling script but nothing happened and form kept resubmitting upon refresh.

    I also noticed that in dd_formmailer.php there was no line to check value of $_POST['_REPEATED'] and unless this is checked I believe resubmission upon refresh can not be prevented.

    Please help.

    Thanks.

  209. 1809
    Sanjeev

    I am using standalone = FALSE and after submitting where we see the thank you page, on refresh / reload the form sending result(s) which i want to prevent. Please tell me how to prevent emailing on refresh after first form submission.

    Thanks.

  210. 1808
    Ken Bird

    I cannot process the email form. Get the following message – Warning: preg_match() [function.preg-match]: Compilation failed: unmatched parentheses at offset 354 in /home/ricniven/public_html/kenbirddesigns/contactform/form4/contact.php on line 333
    Error!
    • Invalid input in ‘Name’!
    • Invalid input in ‘Email’!
    • Invalid email address: ‘Email’

  211. oh my god! i see that you’ve put a lot of work in this! nice work!
    i will try this and i will come back with the result!

  212. Impressive work here.

    I have inserted sql statements into the script and it now does all I can ask. But I have to ask if anyone else has looked to the best placement of sql statements to utilize the security of dd-formmailer?

  213. I have no idea what it means or how it got there, but I will try to double check everything. Anybody?

  214. 1804
    Ruby Works

    Great Script! But does anyone know how to align the form center or right? How would I do this?
    Thanks!

  215. 1803
    Christian

    Hi!

    I’m trying to figure out this excellent script – but all new to php…
    My goal is, that I would like the script to send to an outside-domain, but to make this possible I apparantly need to include another recipient from inside the domain:

    $recipients = 'to=username@OUTSIDEdomain.com|to=user@insidedomain.com';

    All this I actually working fine – but I would love to have the resulting message not show the “user@insidedomain.com”, but only the “username@OUTSIDEdomain.com in the “To:”-field.

    How can I work my way around this?

  216. 1802
    Sven

    The arabic signs was replaced, let me try again with code-tags:

    
    ??????
    

  217. 1801
    Sven

    After upgrading to version 5.8 i found this arabic letters in the message area (sent from dd-formmailer):

    ??????

    I have no idea what it means or how it got there, but I will try to double check everything. Anybody?

  218. Nice script. I needed to make the background of the verification image transparent, so I changed this part:

    
    $image = imagecreate(60, 24);
    
    list($br, $bg, $bb) = ddfm_hex_to_rgb($verify_background);
    list($rr, $rg, $rb) = ddfm_hex_to_rgb($verify_text);
    
    $background_color = imagecolorallocate($image, $br, $bg, $bb);
    $text_color = imagecolorallocate($image, $rr, $rg, $rb);
    

    to this:

    
    $image = imagecreatetruecolor(60, 24);
    imagealphablending($image, false);
    imagesavealpha($image, true);
    
    if ($verify_background != 'transparent') {
        list($br, $bg, $bb) = ddfm_hex_to_rgb($verify_background);
    }
    list($rr, $rg, $rb) = ddfm_hex_to_rgb($verify_text);
    
    if ($verify_background == 'transparent')
    {
    	$background_colour = imagecolorallocatealpha($image, 0, 0, 0, 127);
    	imagefill($image, 0, 0, $background_colour);
    }
    else {
        $background_color = imagecolorallocate($image, $br, $bg, $bb);
    }
    $text_color = imagecolorallocate($image, $rr, $rg, $rb);
    

    Now you can set $verify_background to ‘transparent’. Be sure to generate the image as a png.

  219. Awesome, awesome script, thanks a ton for providing your code!

  220. You talked about having an option to “prefill” a text block (my planned use was an online petition). I don’t see that documented… is that available in v.5?

    Also, I see the new script asks for the the URL of the file. I’d be interested in knowing why that field is needed; I have been cutting and pasting your forms between a couple of sites, and it seems to me like a superfluous administrative step.

  221. If I could hug you I would…..thanks for the script worked wonders.

  222. Version 5.8 Released

    Changes:
    - Added Estonian language
    - Added code to check for duplicate field names
    - Usage of commas in checkbox descriptions is now fixed
    - Fixed garbled auto-reply messages
    - Adjusted the displaying of uploaded file names in the email message
    - mb_encode_mimeheader error in WP fixed
    - Other adjustments to email headers
    - Added ‘id’ declaration to select boxes
    - Fixed incorrect example code in the instructions
    - Other minor changes

    The WordPress version of the script is fully compatible with WordPress 2.8

    A few people mentioned problems with the date chooser field type. I tested this out thoroughly, and it seems to be functioning fine. Just be sure (if you are using the PHP version of the script) that you are including the required javascript file.

    As always, I am not able to implement every single requested feature, but I try to focus on known issues, while implementing things that many can benefit from.

    Support for 100% compatibility of non-US character sets is still something that is being looked into. If you have a good deal of experience with writing custom email headers to fully support international character sets and would like to help us out please let me know.

    Enjoy!

  223. Having an issue when using this inside another page. The script works, but when viewing in design view, it distorts my whole page and highlights like theres an error.
    When i add this to page, it distorts my design view in dreamweaver. It works fine on live preview, but I dont want to have to remove this code snippet everytime I need to make an update and paste it back in.

    I believe this is due to the DocType in dd-formmailer at bottom of page for standalone. is there any way to mod that second doctype out or remove it without

  224. Charlie Markwick I have to thank you ’cause you solved my problem (comment 1770)!!!

    thanks a lot and thanks of course for this very useful script.

  225. please can any one help me in this regard, I need php mailer.

    i will be glad if some one can help me for i have try all i can to locate any but not that easy for me. send me the phpmailer to.. donalvinmosley @ yahoo.co.uk
    i wait to hear very any one.

    Don Mosley

  226. 1792
    Crawley

    If I could hug you I would…..thanks for the script worked wonders.

  227. Hello
    I like your script very much

    Thanks

  228. 1790
    Tony

    Brilliant script!

    Just a quick question…

    If I have a field in the form that contains a group of check boxes and I want to make sure this field is required for the form to be submitted, how do I do this? I can see you can add the ‘required’ parameter to individual check boxes but what about a group?

    Sorry if this has been asked/answered before… spent a long time scrolling through the comments with no luck ;)

  229. I had a client that was closed on Mon. and Wed. He wanted the popup calendar that schedules his appointments to reflect this. I had to mess with the code for a while before I got it to work, and thought someone else might need similar functionality. Starting at around line 205 of the date_chooser.js I changed this:

    
    if (dayNum == day)
          html += TD_selected + TD_onclick + DIV_selected + dayNum + xDIV + xTD;
        else
          html += TD + TD_onclick + dayNum + xTD;
    

    to this:

    
    if (dayNum == day)
    html += TD_selected + TD_onclick + DIV_selected + dayNum + xDIV + xTD;
        else if (thisDay.getDay() == 0 || thisDay.getDay() == 3)
          html += TD + DIV_noday + dayNum + xDIV + xTD;
        else
          html += TD + TD_onclick + dayNum + xTD;
    

    and added a var in the table variable section starting at line 152:

    
      var DIV_noday = "<div class='dpNoneAvail'>";
      var xDIV = "</div>";
    

    and in the CSS changed added the class dpNoneAvail and set it to display: none;

    There ya go, works like a charm.

  230. Thanks for the great script. I having an issue when using this inside another page. The script works, but when viewing in design view, it distorts my whole page and highlights like theres an error.
    When i add this to page, it distorts my design view in dreamweaver. It works fine on live preview, but I dont want to have to remove this code snippet everytime I need to make an update and paste it back in.

    I believe this is due to the DocType in dd-formmailer at bottom of page for standalone. is there any way to mod that second doctype out or remove it without breaking up the script?

    having multiple doc types in a page can cause all sorts of validation issues. Thanks for any help.

  231. Hello
    I like your script very much but I have a question.
    After I send the message, I have instructed the script to go to the original script page (using standalone).
    The problem is that if a user presses reload, the message will be sent over and over again, even without any input in the message boxes.
    Any way arround this problem?

    Thank you

  232. 1786
    Bryan

    I’m getting extra text inserted in the auto reply email similar to post #1638 or no text at all, depending on the email client being used.

    In outlook, the message appears normal.

    In gmail, the message appears as follows:

    –d543e43bb2c87a3daf858807ea0d640c
    Content-Type: text/plain; charset=utf-8
    Content-Transfer-Encoding: 8bit

    Thanks for contacting us.

    –d543e43bb2c87a3daf858807ea0d640c–

    In yahoo, I’m not seeing any message at all.

    Default options except for auto reply fields.

  233. 1785
    Tdinh

    CORRECTION

    <p class="fieldwrap"><label><span class="required">*</span> Is this a new job or a reprint:</label><span class="fmradio">
    <input type="radio" name="fm_job" id="New Job" value="New Job" checked="checked" /><label for="New Job" class="fmradiolabel">New Job</label>
    <br /><input type="radio" name="fm_job" id=" Reprint with Changes" value=" Reprint with Changes" /><label for=" Reprint with Changes" class="fmradiolabel"> Reprint with Changes</label>
    <br /><input type="radio" name="fm_job" id=" Reprint without Change" value=" Reprint without Change" /><label for=" Reprint without Change" class="fmradiolabel"> Reprint without Change</label>
    
    <br /></span></p>

  234. 1784
    Tdinh

    I have a problem with my radio buttons. The form works and everything; the emails are sent correctly. The only thing is that, when I try to validate the code with W3, there’s an error with the ID elements. The problem with the ID elements are that there are spaces.

    Here is my line of code for the radio buttons:

    type=radio|class=fmradio|label=Is this a new job or a reprint:|fieldname=fm_job|req=true|default=1|data=New Job, Reprint with Changes, Reprint without change

    The code it generates when uploaded is:

    * Is this a new job or a reprint:
    New Job
    Reprint with Changes
    Reprint without Change

    It is obvious that IDs cannot have spaces in them, so is there any way for me to correct this so that I do not have any validation errors in my code?

    It would be greatly appreciated in finding a solution to this problem.

  235. 1783
    Ward

    I am still trying to get the redirect to work and I am also trying to include the “recipient” selection from the dropdown list in the body of the email such as Recipient: John Smith – once I get these to work, all will be well. Any help would be greatly appreciated and thanks again for a very special script.

  236. I use both the php and wordpress versions of your script on several websites – they’re just fantastic! Keep up the good work!

  237. I’m very impressed with the site. Very clean design. I will continue taking a look at your php form script and see how I can implement it into my site.

    Thanks again!

  238. Outstanding script! I got it to work right out of the box. The only problem I have is that I can not get the page to re-direct after it is submitted. Is there a fix for this? I have tried both suggested ways in the help file and have searched the comments.
    Thanks again!

  239. 1779
    bob smith

    Is this script and earlier version php5 compatible?

  240. 1778
    jaymz9mm

    Very nice and works great – although one strange thing I’ve noticed, if I enter “test@test.com” in the email field of the form, the email consistently doesn’t get sent lol

    No error or anything, and it says the message was sent.

  241. 1777
    Maurits

    Hi Admin, thanks for the great work!!
    The only thing I did not succeed in adapting to my needs is the positioning of the fields.
    I’d like them on the left on the screen instead of centered.
    Where do I have to look?

  242. 1776
    leo

    hey…

    Sorry, I posted already on the wrong page…

    I use the “non-WordPress” Version (5.7) of this Script and I still have Problems with the german special Characters in the “Sent” Mails.

    Does anybody have some ideas for me?

    thanks a lot. leo

  243. 1775
    Gary

    i was looking for a mail-script to replace the flawed “Matt’s Formmail”. This one is quite complex. Can it simply be called from a form I’ve already designed on my site, rather than me using it’s custom architecture to create my form?

    thanks.

  244. 1774
    villas

    I need to know how to put another field : “email confirmation” that is to prevent email digitation error (and verify if 2 fields “email” are equal. Sory my bad english. Thanks

  245. Great script and it just keeps getting better over the years. I would suggest for future releases a couple things.

    1) Making uploaded file names unique by appending date()
    2) Including any uploaded file names in the notification mail

    ~ carry on ~

  246. 1772
    mcChris28

    oh snap!…it was because i tried to implement my own submit button image and value, removing DDFM_SUBMITBUTTON… :(

    anybody done this before?…i can’t find this variable lurking anywhere but in the form output area…how/where is the ’send email’ value generated?…

  247. 1771
    mcChris28

    i’m using this script for the first time, as an include, and i’m having an issue with the form submitting the email…

    in ff and chrome my form submits just fine and email is received…

    in ie6 and opera, on submit, there is no $sent_message generated…the page refreshes with a new verification image…no email is sent…

    i’ve yet to test ie7-8 and safari…

    and i don’t see any other comments regarding this issue…perhaps i’ve done something wrong…any thoughts or suggestions?

  248. great script. However as it stands (Version 5.7) the script generated an error for me:

    Use of undefined constant mb_encode_mimeheader - assumed 'mb_encode_mimeheader'

    It is resolved by changing line 595 from:-

    if (function_exists(mb_encode_mimeheader)) {

    to:-

    if (function_exists('mb_encode_mimeheader')) {

  249. Excellent script!

    I am having a curious problem though that I can’t solve. A typical contact form (email, name, message) plus one file-upload input field. Everything works fine on all browsers on both the PC and Mac (IE 6/7/8, Firefox, Opera, Chrome)… all except for Safari 4 Beta and Safari 3 on the Mac. When submitting the form with a file attached, Safari just hangs… until I hit the submit a second time, then it works fine. It is not even that consistent. 20% of the time or so, it does work on the first submit, but the rest of the time requires two submits.

    I’ve been searching the web but can’t figure out if it has anything to do with your script, or, morel likely a Safari, Javascript, jQuery oddity.

    Any thoughts will be much appreciated.

  250. Hi,
    Great script! Worked out of the box with no issues and I’m just a PHP code nugget! Thanks again!
    Cheers,
    James

  251. 1767
    Rob Cook

    Has anybody come up with a way to include the results of a type=selrecip in the body of the email message? I’ve seen the question asked several times, but haven’t seen any answers.

  252. 1766
    dell

    can this script be called from an html file? Im wanting to have the mail form on numerous pages but dont want to have to rename a bunch of them to .php files.

    I hope this can be done as I really like the layout and look of this script, and its ease and functionality.

    Thanks.

  253. 1765
    MowC

    Is there a way to style the button, replacing it with an image?

  254. As Jacob, I also cannot get the asterisk to display for the required fields. They are req, and the form works fine, if req fields aren’t filled in the error message displays. I know the lang file is being read as the submit button, and error messages report correctly. It’s just the asterisk that don’t display.

    I have check my CSS files, the dd-formmailer.css and all other settings and everything checks out. The other forms on my other sites work fine and show the asterisk, and I can’t figure this out.

    Note, of the 4 other forms I use, this is the only one that is the latest version… dunno if that helps.

  255. Hi, is it possible to send the fields from the form as an email attachement?
    Thanks a lot,
    Miro

  256. What is the license of this script?
    Perhaps indicate on the page and script itself.

  257. 1761
    Jo

    How do you format the auto reply?
    –start code–

    $auto_reply_name = ‘Made up Company’;
    $auto_reply_email = ‘info@madeupcompany.org.uk’;
    $auto_reply_subject = ‘Auto Reply’;
    $auto_reply_message = ‘Thank you for contacting Made Up Company, we will endeavour to get back to you at the earliest convenience. Here is a copy of the message you sent for your records. fm_message Many thanks’;

    –endcode–

    As you can see I’ve included the senders message into the auto reply. But I would like to be able to add new lines and rulers.

    –startexample–

    Thank you for contacting Made Up Company, we will endeavour to get back to you at the earliest convenience.
    NEW LINE HERE
    Here is a copy of the message you sent for your records.
    RULER LINE HERE
    fm_message
    RULER LINE HERE
    Many thanks

    –endexample–

    Hope someone can help, cheers.

  258. 1760
    bcoadmin

    Oops, sorry about my last post – the code was not wrapped correctly!

    @Jacob,

    The problem is possibly due to your hosting server or ftp program forcing lowercase filenames.

    In dd-formmailer.php change the following: -

    $language = ‘lang/English.php’;

    to

    $language = ‘lang/english.php’;

    Hope this helps…

  259. 1759
    bcoadmin

    @Jacob,

    The problem is possibly due to your hosting server or ftp program forcing lowercase filenames.

    In dd-formmailer.php change the following: -

    $language = ‘lang/English.php’;

    to

    $language = ‘lang/english.php’;

    Hope this helps…

  260. 1758
    franky

    Ben is right, a forum would be great.

  261. 1757
    Dario

    Can I customize the errors page? I use the code integrated on my website design but when the client misses the code or any require data, the form shows without css format and on a new page, what can I do to preserve my design on missing info errors?

    Thanks.

  262. I suggest we start a forum for this script, there are some good messages here (and replies) but I have trouble locating them easily in this format.

  263. I see several comments asking about the error “No Verification Code Generated” this will appear in browsers with session cookies disabled when verification is set to “basic”

    You can change your verification method to ReCaptcha or change the error message to explain what is happening.

    In lang/English.php I have redefined ‘DDFM_NOVERGEN’ to read
    define('DDFM_NOVERGEN', '<br /><a target="_blank" href="http://www.tubal-reversal.net/cookies.htm"><img src="http://www.tubal-reversal.net/images/icons/enable-cookies.gif" alt="Please allow cookies to use this form." width="222" height="26" border="0" /></a><br />');

    eg. tubal-reversal.net/feedback/index.php

  264. Just wanted to post a tip for all those who want to “secure” their data.txt file.
    Don’t call it data.txt, call it data.php instead. And begin with these lines:

    <?php echo "njet!"; ?>
    <?php return null; ?>

    So even if someone finds out the path to your file, they’ll get nothing.

  265. 1753
    sharp

    :( I don’t know why all russian characters transforms to ‘???’. There is Unicode, isn’t it?

    I downloaded screenshot to imageshack:
    ________img207.imageshack.us/img207/5629/eml.gif

    Ooo, And I forgot one more thing to tell:
    I tried to read messages in Thunderbird, Outlook, Gmail and another 3 web-servers. Everythere the charset in name and subject was incorrect.

  266. 1752
    sharp

    oops… correction:
    ???????? = ‘???? ?????????’
    and in
    596
    $email_subject = mb_encode_mimeheader($email_subject, 'UTF-8', 'Q', '');

  267. 1751
    sharp

    First of all, Dagon Design, thank you for great script! It’s really clear and very adaptable.

    But I have one problem with charset (for non-English characters) in headers (“name” and “subject”) which I can’t solve.
    I use UTF-8, but all messages have “name” and “subject” in another charset (ISO-8859-1 or ISO-8859-5)
    For exapmle of “subject”:
    Тема СообÑ?ения
    instead of
    ???? ?????????" (in Russian)
    And that what I see in code of message:
    =?UTF-8?Q?=C3=90=C2=A2=C3=90=C2=B5=C3=90=C2=BC=C3=90=C2=B0=20?= =?UTF-8?Q?=C3=90=C2=A1=C3=90=C2=BE=C3=90=C2=BE=C3=90=C2=B1=C3=91=C2=89?= =?UTF-8?Q?=C3=90=C2=B5=C3=90=C2=BD=C3=90=C2=B8=C3=91=C2=8F?=

    There is the same situation for another non-en languages (I also tried to use Spanish and Japanese characters in headers) – the same result for “name” and “subject”.

    Everywhere in dd-formmailer.php I have only “UTF-8″:
    596 $auto_reply_headers .= 'Content-Type: text/plain; charset="utf-8"';
    597 $sender_name = mb_encode_mimeheader($sender_name, 'UTF-8', 'Q', '');
    631 $msg .= 'Content-Type: text/plain; charset="utf-8"' . PHP_EOL;
    1891 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    And also utf-8 in auto-reply settings (I don’t use it).
    There is nowhere any another charset set – firstly ISO-8859-x.

    I tried to ad utf-8 in mb_encode_mimeheader, mb_internal_encoding to headers, but it haven’t help me.

    I tried to use script in standalone mode and in another file.
    I use UTF-8 in of site and I tried to add AddDefaultCharset UTF-8 in .htaccess – unfortunally nothing.

    And of course, I tried to find decicion in this comments, but I couldn’t found any of.
    Anybody, please, help me to solve this problem!

  268. 1750
    David

    Form seems to be working, except that *no* error messages appear. I have multiple fields set as required, and am including reCaptcha, but the form submits no matter what is input in any field (or if the fields are left blank).

  269. I’m still Having the same Problem, With the message “DFM_REQUIREDTAG”, I’ve Check The Lang Assignment as far as I can tell its correct, However The one thing about the lang Path it is the only one in the script that asked for the “relative path” Path while the other path ask for the URL. I’m really Desparate Now, I also need it to upload images with its feedback. Will Someone please Help.

  270. Jacob it sounds like you lang files is not being read.

    On our site some users are reporting the error ‘No Verification Code Generated’, is this because of problems with cookies and how can i fix this?

  271. I’m really getting desperated. I’ve been waiting thinking I was going to get an email reply when someone answered my question. Can Someone please tell me what does it mean when it print “DDFM_REQUIREDTAG” above a field? I really want (need) to get this Form Up and running. Please Help.

  272. I uploaded the script. My Problem Is When I call up the script the form Displays On the screen and above each field Printed in Red, “DDFM_REQUIREDTAG” I know its something simple. I’ve read and read but cannot find any writeup about this kind of thing. Help Please.

  273. 1745
    harp

    WORKS: autoreply works, don´t now why! Changed the $sender_name and $sender_email (had the same data in $auto_reply_name and $auto_reply_email)

    Works great now!

    Other question: is it possible to send html in $auto_reply_message. Or at least have line-breaks …

  274. 1744
    harp

    Auto-reply is not functional (Version 5.7). I´m getting the mail for the website-host, but no auto-reply-mail for the sender!

  275. Fasthosts requires that the -f extra parameter is used in order to function properly and send the form data to the requested inbox.

    I found that I had to modify Dagon’s suggested code in the troubleshooting section to get it functioning properly:

    From

    $send_status = mail($send_to, $email_subject, $msg, $headers”, “-f user@domain.com“);

    to

    $send_status = mail($send_to, $email_subject, $msg, $headers, ‘-f user@domain.com‘);

    In other words removing the errant ” and replacing the double quotes with single quotes. Everything appears to be working fine now. Thanks to DD for an excellent script.

  276. 1742
    hatem

    In the registration form write the code needed to prevent the system from signing up a with a number name or a name containing a numbers.

    Add this code to the registration form. Test it and upload the whole file as a text file

  277. 1741
    SKS

    MISSING “javascript pop-up date chooser” !!

    I have been using this great script and is quite happy with it. But today after downloading and put into use, I was quite surprised that even though adding javascript pop-up date chooser is there in the instructions in this very page but all components: calendar.gif, date_chooser.js and css section for this popup calender were removed. After studying the dd-formmailer.php I also noticed that whole section to manage “type=date” was gone missing.

    I wonder was it done by purpose to avoid some security issues or was it a mistake because I did not find any mention here in this matter.

    Any update please?

    Thanks.

  278. Hey All. Best script out there! Anyone know how to use a checkboxes as recipients? Would mean the world to me to make this happen. Thanks Fellow humans!

    Danny

  279. 1739
    dv

    gotta question. my form was working fine. Im now trying to incorporate into a https site. The form works in firefox, but in IE 8, it give me a verification error. Errors!No verification code generated

    It generates a code, but its not recognizing it for some reason. any idea what could be causing this to only happen in IE8?

  280. 1738
    dv

    Jacob, make sure your formmailer path is correct in dd-formmailer.php or whatever you renamed it too.
    $language = ‘dd-formmailer/lang/English.php’;
    around line 44.

    Also make sure you have this in your actual contact page in header.

    Check and see if this helps or points you in right direction.

    Might also want to check the language file as admin suggested a few posts down.

  281. I’ve Set up The Form-mailer. My Problem every field displays “DDFM-Required” In the submit button it’s showing “DDFM_SUBmit BUTTON” What Am I doing Wrong?

  282. 1736
    Bob Alanis

    Dang. Sorry for the multiple posts. I just tried my subject line suggestion and it did not work. My subject line ended up being…

    Subject: Bob Alanis has uploaded to your site

    So it stripped out the file name from the subject line. Any help would be greatly appreciated.

  283. 1735
    Bob Alanis

    Me again. I just realized that I can add the upload field name (fm_upload) to the subject line. So the subject line can be…

    $email_subject = ‘fm_fullname has uploaded fm_upload to your site’;

    It would still be nice to be able to list the files in the body of the email however in case there are multiple uploads (to prevent the subject line from becoming huge).

  284. 1734
    Bob Alanis

    Fantastic script, have been using it for over a year and have been able to always get it do what I want.

    I have a question about the file upload portion. Is it possible to list the file that was uploaded in the email? So the file itself will be saved to the directory, but the email generated will list that file name?

    That way if you get lots of people uploading files, you’ll know who uploaded what.

    Thanks again for this awesome script!

  285. 1733
    Gary

    Hi,
    Great script….just one question. I use a Dreamweaver Captcha extension by (top dreamweaverextensions) I’d really like to use this to protect the form. It normally sits in the form tags but of course things are different here.Do you know If its posible for me to use it somehow?

  286. I’m having a problem with the script generating strange characters when I call it from my contact.php page.

    The characters are  [(an i with umlat) double right brackets and upside down question mark]. The only references I can find to this phenomenon is relating to UTF-8 BOM and the fix was specifically for Joomla. Any help?

  287. dv: Make sure your language file is not corrupt – that constant should be in the file, where you can define it. Worst case, re-upload english.php to /lang/ (or whichever lang file you use)

  288. 1730
    dv

    Im having an issue with this formmail. Instead of showing asterisks for required fields, Im getting DDFM_REQUIRED.

    An OP named Henry had same issue way back, but replied with only I figured it out and didnt state what the fix was. Strange thing is it works just fine on a testing site on another server? Thanks for any help with this.

  289. Version 5.7 Released

    Fixed issues regarding the saving of attached files, data selection values not being recorded, and various minor fixes. Inline styles have been removed from the two field items that contained them.

  290. 1728
    dev

    I think I found out whats causing my page to not look right in design view in dreamweaver, but not sure how to fix it. Its the header and footer at bottom of dd-formmailer.php I have $standalone = FALSE;
    but i think it still calls the head tag. which is why in my include page the is highlighted being an error in code somehow.

    Being I dont want to use standalone, can I simply delete the header / footer ? If so where would I start and end?

  291. 1727
    dev

    Hello and thank you for this great script. I am using dreamweaver to build my site and when I add the to my page my design view in DW goes bonkers. I see the two little php icons, but theres a highlighted in yellow which means an error somewhere. The form still works and look sgood live on site, but i have images next to form and text below form and they are not showing in DW now. They do show up live, but my concern is when I have to make updates to this page I cannot see any images or page info. If I take out the include, everything shows up fine. Theres got to be a simple explanation for this and most likely my own fault, but I cant figure out for the life of me. Thank you for any help.

  292. 1726
    Gregg

    The script has possibilities but it shouldn’t be available for download in it’s current state. To all you people who are pleased with it, have you actually tested all the form elements to see if they work? Well, they don’t and I think this project has been abandoned. The code is overly complicated and that’s not good when a script isn’t working because it makes it hard for anyone to fix. I can tell you though that the “$form_struct” is in a mess. Only certain elements are correct in it. I’m very disappointed to have spent three days integrating a better captcha in the script only to find out that it only partially works. If your going to put up open source code then it should work reasonably well. I don’t think this script is finished and I’m certainly not going to spend my time finishing it. It would be easier to just start from scratch, given the over complexity of the code.

  293. 1725
    Gregg

    I am finding a lot of bugs in the script that I downloaded. The example widtextarea form element always get the error message “character limit for ‘Message’”. The example textarea form element doesn’t get the message so I compared the two validation routines in the script and guess what. There is no validation for the “textare” and the validation for “widetextarea” does work. Furthermore, when viewing the source in the browser, neither one of the form elements contains a value for rows. The select boxes don’t work either. I am begining to think I got a bad download as I see noone else is complaining about such obvious errors.

  294. 1724
    Gregg

    Great script. I have one problem so far. When I copy and paste and of any of the select box examples, the select box displays but it has no items/options in the box.

  295. This script works wonderfully. One question – can I customize the errors page? Can I simply have the form display my own page instructing the user to go back to the form and fix the errors rather than display the awkward text on a white page?

    Thanks.

  296. I use the code integrated on my website design but when the client misses the code or any require data, the form shows without css format and on a new page, what can I do to preserve my design on missing info errors?

  297. 1721
    Asc

    Hello,
    very nice formmailer, thank you!
    I use it as a registration form and my question is if there is a possibility to set some fields for required ONLY if an other one (i.e. radio button) is selected?

  298. 1720
    Keith

    Just answered my own question (1719)
    Put each field on a new line

    $message_structure = 'From: fm_name
    Message: fm_message
    Reply To: fm_email';

  299. 1719
    Keith

    Secure PHP Form Mailer Script
    I also need some help with the syntax for the $message_structure variable. Specifically how to insert new lines same as 1711. Thanks in advance.Excellent Script

  300. Is it possible to allow for multiple auto-replies? My form is a referral form, and I’d like to be able to send one auto reply to the person making the referral AND one auto reply to the person being referred. Currently the auto reply seems to just send to the first email address in the form.

    Any help would be greatly appreciated.

  301. 1717
    420

    If you would like to create an onclick or onfocus event for this script you may do so as such.

    
    //Create an onclick, open new link, function like so:
    type=type|class=class” onclick=”javascript:window.open(\’http://www.yoursite.com\’)|label=
    
    // //Create an onfocus clear function like so:
    type=type|class=class” onfocus=”clearDefault(this)|label=
    

    DONT forget to add the javascript for the onfocus;

    <script type="text/javascript">
    <!--
    function clearDefault(el) {
    if (el.defaultValue==el.value) el.value = ""
    }
    // -->
    </script>

    I hope this helps someone This script ROCKS!

  302. 1716
    420

    Hello I would like to give some advice. If you would like to create an onclick or onfocus event for this script you may do so as such.

    //Create an onclick, open new link, function like so:
    type=type|class=class” onclick=”javascript:window.open(\’http://www.yoursite.com\’)|label=

    // //Create an onfocus clear function like so:
    type=type|class=class” onfocus=”clearDefault(this)|label=

    DONT forget to add the javascript for the onfocus;

    I hope this helps someone This script ROCKS!

  303. 1715
    john

    How can I make a radio button that, when clicked, re directs users to a new page in the same window?

  304. 1714
    Mike

    Hello, I’m having trouble getting the data-saving function to work. I’ve tried storing the file both in wordpress root and plugins folder but no data is storing. Permissions are set to 777.

  305. Can anyone please help me? I would like to create an onclick function for some of my radio buttons. What is the easiest way to accomplish this? Thank you.

  306. 1712
    Pengu

    I’m using latest release as stand alone. I configured it to write to file and not send an email. Everything works, writes to file and displays “thank you” message BUT it also displays form directly below Thank you message. (form doesn’t disapear after hitting send).
    Did anyone else have this problem and/or solution?
    btw – great script, thank you!

  307. 1711
    Steve Nelson

    I’m sorry – this feels like such a dumb question. But I need some help with the syntax for the $message_structure variable. Specifically how to insert new lines. I wish to receive an email with the sender’s name, their phone (a custom field I added) and their message, each separated by new lines. I can’t figure out how to insert any sort of new line character in that variable. Anyone else figured this out?

  308. 1710
    tip

    Very good webpage you have here, and best greetings to all your visitors

  309. Hello again !

    May my text missed some informations for somebody could help me to resolve my problem (excuse me, my english isn’t great : i’m french:)

    Here is the part of my code who create two fields for anybody can choose the recipients of the mail :

    type=text|class=fmtext|label=Email recipient 1|fieldname=fm_email1|max=100|req=true|ver=email
    type=text|class=fmtext|label=Email recipient 2|fieldname=fm_email2|max=100|req=false|ver=email

    And her is the line of the problem :

    $recipients = 'to=fm_email1|to=fm_email2';

    So I would like the content of the two mail fields replace the “fm_email” of $recipients.

    Thanks for your answer !
    Arnaud

  310. Hello All !

    Great job Mister Dagoon !
    I would like to know how to give the possibility, to the users of your secure form mailer, to write the emails of recipients in some text fields (like fm_email1, fm_email2, fm_email3 etc.).

    Is it possible ?

    Thaks for your answer, and congratulation for your job.
    Arnaud

  311. 1707
    Steve Nelson

    Hmmm. Lets try that again.
    Down around line 300 I needed to modify what’s inside the include once parenthesis to read
    ($_SERVER['DOCUMENT_ROOT'].$language);

  312. 1706
    Steve Nelson

    Ah. Okay. My host (DreamHost, PHP 5. something) seems to need this prepended:
    $_SERVER['DOCUMENT_ROOT'].
    So for me, line 300 needs to read
    @include_once($_SERVER['DOCUMENT_ROOT'].$language);
    Now it’s all wonderful!
    Steve

  313. 1705
    Steve Nelson

    Wonderful wonderful resource. But I’m having an odd thing happen with version 5.6, (using it as an include NOT standalone). It works (sends mail) but some of the constants don’t seem to be defined. For example, I have several “required” fields and instead of a red asterisk they are red text reading “DDFM_REQUIREDTAG.” Additionally, the submit button reads “DDFM_SUBMITBUTTON.” And if I deliberately force an error, the error report reads “DDFM_ERRORMSGDDFM_MISSINGFIELD ‘Your Name’ (and so on, each error labeled with the PHP constant, not replaced with meaningful text. Did some constant definitions get lost or did I screw something up? Thanks.

  314. I am very impressed by the number of replies to this post.
    I am number 1697 Amazing.

  315. 1703
    Bill

    Hi – been using this for years on various websites, but I’ve just installed the newer version within an exisiting PHP page and appear to have a large space above the the form.

    I’v tried tweaking some CSS elemnts in the style sheet but can’t get rid of this white space/shift the form up – does anyone have any ideas on how to do this? Cheers ;O)

  316. hi. i have been a longtime user of your script, embedding it in several sites. i see some changes in the newer versions, and have two questions.

    1. i see that the script now takes visitors to a new page as opposed reloading the current page with the confirmation message. i don’t see an option to specify an alternate landing page. having specific landing pages is certainly important — am i missing something?

    2. why do you require a full url including domain name? i often develop sites in folders and subfolders and copy elements between sites. the hard-coded reference is difficult to deal with because it needs revision with every such site change!

    thanks for an excellent and very useful script.

    dan

  317. Script works great – thank you!!

    I’m not brilliant with php – but I’ve used tags in the form labels – and they work great, but they appear in the email submission and I would like to not see them.

    Sorry for such an inane question!!!

  318. Whoops again in 1704. I found that if my sql is outside of the brackets for // Validate input
    foreach ($form_struct as $fs) {
    then a “%0d” will cause an error message but still be inserted into the db. So the sql should be just before the closing bracket of the Validate input struct. About line 1500 something depending on how many lines you have added already to the form struct (it was 1571 for me).

  319. I’ll take post 1704 back. Just tested placement of sql and it works quite securely placed just about anywhere. It either striped any malicious character out of the form or gave DDFM_INVALIDINPUT error for everything I could think of. I’ll get back to you if I can find any security holes in this script.

  320. Impressive work here.

    I have inserted sql statements into the script and it now does all I can ask. But I have to ask if anyone else has looked to the best placement of sql statements to utilize the security of dd-formmailer?

  321. 1697
    Roger

    Got the success message working, (Re msg 1701), I wasn’t using the field name. Works now: >Thank you fm_name- your message has
    been sent.

    Everything works great, Thank you for all of your work.

  322. 1696
    TPL

    Hi very nice work Thank You.
    Little problem I cant find an answer to. When using the javascript date picker I can’t get the dates selected to become required. If set to required and no date is selected it does not show up in the error section when submitted. Any help with this would be very appreciated – Thanks.

  323. 1695
    Roger

    How do I include the sender’s name in the “Success” message? I know you use the field name, but what code do you enclose it in or how do you get it to work so it doesn’t display “field name” as straight text.
    $sent_message = '<br><br><br><center><h1>Thank you - your message has been sent.</h1></center><br><br><center><h3>Return to <a href="../index.html">Home page</a></h3></center>';

    I want it to say Thank you (sender’s name) -

  324. 1694
    Jamie

    I cannot get this to work (I am sure it is my error, being new to this).

    I have emailed the author, but as yet, have not received a reply.

    Is there anyone out there that would be willing to talk me through this or better still be prepared to do this for me?

    Many Thanks.

  325. 1693
    servo

    dangit, missed the two previous comments until after I posted.

    I tried the following, which changed the problem for me.

    By doing this:
    I changed
    line 1300 from
    switch ($fs['type']) {
    case ‘text’:

    to
    switch ($fs['type']) {
    case ‘text’:
    case ‘date’:

    It now validates and adds the date, but now does not validate the rest of the form’s contents… Ideas?

  326. 1692
    servo

    Awesome, awesome script, thanks a ton for providing your code!

    I love the new enhancements but can’t seem to get the date/calendar selection javascript to work properly.

    It displays as intended (ie with the image and drop down div), but when the form’s submitted, the date contents aren’t being added to the email contents. Similarly, the validation doesn’t seem to work either… Probably a related issue.

    Any ideas?

    Thanks again!

  327. 1691
    Tiffany

    I sincerely thank you.

  328. I changed
    line 1300 from
    switch ($fs['type']) {
    case ‘text’:

    to
    switch ($fs['type']) {
    case ‘text’:
    case ‘date’:

    and the date now appear in the email.

  329. I have an issue with date fields they are not being added to the email message?

  330. 1688
    Stephen

    Hey guys, just wondering if anyone is able to help with requests in posts #1687 and #1689 (plus #1597 and #1684)? :)

  331. 1687
    Nefret

    Both new and old version’s verification code does not work!!!!

  332. 1686
    Stephen

    Hello again :)

    Just wondering, in addition to my request in comment #1687, how would I set up the auto reply to come from the email address selected in selrecip?

  333. 1685
    Stephen

    Firstly, just wanted to say what an absolutely wonderful script this is, thank you. Excellent work!

    Secondly, I just wondered how you go about including data from ’selrecip’ into an email or an auto response?

    In your example selrecip code:

    type=selrecip|class=fmselect|label=Recipient|data=(select),User1,user1@domain.com,User2,user2@domain.com

    selrecip doesn’t seem to have a fieldname, so how would we pull in the data from that? Do we add ’selrecip’ instead of fm_fieldname?

  334. For those still asking about SMTP I think this script still uses PHP’s native mail() function. Thus, if your SMTP server requires authentication the script won’t work; at least as far as I can tell. I’d love to see this script using the PHPmailer class from codeworx, but I don’t know how they’d feel about the competition with their own form to email script.

  335. I have been using this script for some time now for a number of client. It has been extremely useful. and I am very appreciative of the hard work that has been ongoing to keep the script up to date. For a new client, I am trying to populate a select field with values from a database. I can get this to work fine, but then the verification image disappears. As soon as I remove the query, all is fine. Has anyone successfully been able to retrieve values out of a mysql database and populate a select field with this script?

  336. 1682
    Mia

    From Patrick #1597 :
    ———
    I have added selrecip as my recipient and added a drop down with the name of the dropdown and the email it goes to, however i want that dropdown to be the subject of the email.
    ————

    Same here. I would like the selected recipient to either be included in the subject line or in the body of the email. How can this be done? Thank you!

  337. 1681
    MikeReills

    HI – great script easy to implement as well. I am trying to make more use of it but I have an issue with passing a value. Essentially I have a holiday site with a number of holiday villas. If someone likes the look of a villa they can click enquire which will take them to the form-mailer. I want though to be able to pass the villaid into the form – is there a way to do this?

    I am no PHP guru so struggling to see how this can be used? any suggestions would be great.

  338. 1680
    Felix

    Problem solved. Forgot to change one old file previous version. Now everything works fine.

  339. 1679
    Felix

    Hi Matt,
    Great improvement, calendar is cool. Going to try that.

    Since updated to newest version 5.6 the asterisk is not showing AND the verification field with its corresponding img is not showing either. I have all other fields working, all paths are ok, $show_required = TRUE; set, type=text|class=fmtext|label=Onderwerp|fieldname=fm_subject|max=100|req=true set and type=verify|class=fmverify|label=Test set. The error file is of course repeating that the verication has to be done before submitting, as without that field showing up you can’t do that and no email can send out. I’m puzzled.

  340. Whenever I am pressing submit I am getting the message “No verification code generated”. I have checked all server settings and it does not work. On one of my sites it works fine and on the other not. Although the configuration is the same. Is anybody facing the same issue?

  341. On my website http://www.targetwebsites.co.uk is a contact form. I’ve tried to incluce a check box into the form (at moment its just text fields).

    I’ve tried the above code to setup a check box but get an error saying “.has_no_newlines prameter incorrect”

    Any ideas?

  342. I want the email subject to be generated from a select field so when the user submits the form whatever the user has selected in the dropdown becomes the email subject.

    Can you help?

  343. Ok, I solved the problem with the date coming from the “javascript pop-up date chooser” not showing in the email sent from the script.

    Go around line 1400 (in my script it’s there, but it depends on how many lines of script you put in the configuration part) in the dd-formmailer.php file and BEFORE this two lines of code:

    case 'textarea':
    case 'widetextarea':

    paste these lines:

    case 'date':
    				
    // type=date|class=|label=|fieldname=|req=(TRUEFALSE)
    
    $t = ddfm_stripslashes($form_input[$fs['fieldname']]);
    
    if ((strtolower($fs['req']) == 'true') && ($t == "")) {
    
    $errors[] = DDFM_MISSINGFIELD . " '" . $fs['label'] . "'";
    
    }
    
    $csv .= str_replace($save_delimiter, ' ', $t) . $save_delimiter;
    $mail_message .= $fs['label'] . $msg_field_sep . $t . $msg_field_line_end;
    $message_structure = ddfm_str_replace($fs['fieldname'], $t, $message_structure);
    $auto_reply_message = ddfm_str_replace($fs['fieldname'], $t, $auto_reply_message);
    $sent_message = ddfm_str_replace($fs['fieldname'], ddfm_bsafe($t), $sent_message);
    
    
    break;

    and everything should work (for me, it works). And if it doesn’t work for you… sorry, I’m a php newbie :-)

  344. Hi I’m using the last version and some older versions of this plugin, but abslout irrelevant which version ..
    I get:
    “No verification code generated” when trying to submit my form.

    Server issues the same as in the pat, but it doesn’t work now.

    the new verfication sends incorrect html and if I’m using this I have the spam protection on every form but I do not need spam protection on every form on the website :(

    I’ve tried every possibilities- nothing:
    “No verification code generated”

    do you or others have a solution?

    thanks a lot

    Monika

  345. 1673
    beyondesign

    This is an amazing product! Thanks so much. However, quick note to end users: DO NOT CAMEL CASE YOUR FIELDNAMES! I spent the better part of 2 hours trying to figure out why some field returns were blank and others populated when all form fields were filled before submitting. Just before calling it quits I dropped the cap(s) and all is now well.

  346. 1672
    Jeff

    FOR ANY ONE WHO MAY HAVE THIS PROBLEM!!!

    Hey – great script! BUT I just stayed up all night trying to figure out why it wouldn’t repopulate the fields on error, and why the asterisks were not showing for required fields.

    Not being a PHP genius, it probably took my longer than it would have taken most of you.

    It seems that the php setup I’m running on doesn’t like the Globals. I haven’t looked, but I’m sure its running as CGI with register globals “off” and whatever other extra security they might have turned on.

    Here’s what you do:
    1. In each output function comment out the line that declares the globals. They look like this:
    global $form_submitted, $form_input, $show_required;

    2. Add those variables to the list of vars required by each function (defined right above the line you just commented out – I’ll use the text one as an example):
    function ddfm_gen_text($item,$form_submitted,$form_input,$show_required) {

    3. Add those variables to ALL the function calls in the loop that creates the form (these are somewhere around line 1820 in my version (again I’ll use the text function call as an example):
    case 'text':$o .= ddfm_gen_text($f_i,$form_submitted,$form_input,$show_required); break;

    There you go. The array with the input will now be fed to the function so it will get output back into the boxes on the form.

    It’s 6:21am here, so I hope this helps SOMEBODY!

    Again, thanks for the script! I can get back to enjoying it!

  347. I would like to know how to make the script return to an html thankyou page instead of just displaying a text line in a blank browser page.

    Thanks.

  348. 1670
    Martin

    @Benjamin

    You can change the width of your input/textarea elements by defining the width in your style sheet (css file).

  349. 1669
    Benjamin

    Oh and I am referring to type=text (not type=textarea).

  350. 1668
    Benjamin

    Andrea – sorry should have worded my question better. I don’t have a problem adding rows to text areas. The problem I have is making specifying a width so that they all the same size. Currently my text boxes and text areas are of different lenghts, I want to be able to add in a value so that they are all the same legnth. Any suggestions?

  351. Benjamin,
    The textarea field type has a special parameter – rows which defines the number of rows in the field (required for valid html).

    Example:

    type=textarea|class=fmtextarea|label=Message|fieldname=fm_message|
    max=1000|rows=6

  352. 1666
    Benjamin

    Does anyone know how to change the sizes of the textboxes and text areas?

    I presume the code to change is here:

    $form_struct = ‘
    type=text|class=fmtext|label=Name:<BR>|fieldname=fm_name|max=100|req=true

    Essenitally one would add “type=value”, however this does not work. I have tried using a value with pixels, all types of bracket configurations, different things than ’size’ such as number_of_chars, etc.. nothing seems to work.

    Anyone got any ideas on how to change this? Am I editing the wrong piece of code?

  353. Need a countries list for you DD form. I created one, available here : http://kevinfilteau.net/2008/11/liste-des-pays-pour-dagon-design-form-mailer-script/

  354. I would like to send HTMl in my auto-reply email. I have seen a few people ask that question but I can not find an answer. Can someone let me know?
    Thanks!
    LB

  355. Great script. Been using it for a while. Thanks!
    My question / problem is about saving attachments to the server. Attachments email just fine, but I cannot get them to save to the server.
    I’ve enabled save_attachments = TRUE and tried setting the save path to everything from /home/mayelala/public_html/carform/upload/ to just /upload/ and nothing seems to work, no errors generated. I’ve set the permissions on the upload subdirectory to everything from 666 to 777, still with no help.
    Any help would be appreciated. Thanks!

  356. Same problem here with dates not passing to email or to data.txt file.
    This is a really great addition if it would work.
    Many thanks for the script everything else works fine.

  357. 1661
    Peter

    Do you know how to have the description displayed on one line and then the input box right below it, instead of side to side?

  358. 1660
    Dell

    Is it possible to mod this form to have entries calculate and show a totals at bottom of list?
    If this requires a custom project can you please email me with estimate. Thank you.

  359. Same problem here: no date passing to the email from the date field

  360. Hello,

    I’m getting a “No verification code generated” when trying to submit my form. I haven’t done anything special here. I have tried specifying “gif” under $force_type, but that hasn’t made a difference. Any suggestions would be appreciated.

    Thanks.

  361. 1657
    Mullie

    The dates are not passing to the email or data file. I also had to change $save_files to $attach_save to get the files locally on the server.

  362. I am using your form with the new date select and it looks great on the form but there are two problems:
    The date field is not validated and can be blank without any error
    The input data is not reported in the email (though every other field on the form is properly included). Seems like a path error, but the page can find date_chooser.js without any problem. Weird. If you have ideas I would love to hear them. Thanks for the new updates. I owe you some money!

  363. My post seems to have been removed. Where can I find specifics on setting up the delimited file posting? I’ve used the search box on this site and used google with the string “delimited site:www.dagondesign.com” which searches the entire site for the term and couldn’t find anything. Please help. Poetry Night in OKC is on the line!!!

  364. 1654
    MelH

    Can we change selrecip to checkboxes instead of a drop down select field? I want the user to check of which recipient to send the message to, choosing 1-n recipients.

    thanks!

  365. 1653
    Mrs B

    Thanks for the script. Got a query regarding the file upload field though.

    If I miss out a required field then when the form is regenerated underneath the error message the values for most of the fields are retained – so they don’t have to be re-entered. This doesn’t seem to happen for the file upload field though.

    Can the file upload field details that the user has entered be retained when the form is re-generated – or is it somehow different in this case? I’ve had a look at the code and the ddfm_gen_file function doesn’t seem to have the same if ($form_submitted){... section that other generation functions have. Is this the key? I’m not familiar with PHP and can’t follow the script details.

    Thanks for any help.

  366. thanks for sharing. I have downloaded it.

  367. Excellent script you’ve constructed. I really don’t know much about php at all. I’m using your script and everything’s working perfectly, except in IE6 for some reason, when I hit the submit button the form just clears the entered results and doesn’t send anything or present a thank you message. Any ideas?

  368. 1650
    Muhammed S.

    Just to say thanks to the programmer of this script!!

  369. 1649
    dell

    If I want to store submitted formmail info into a delimited data.txt file, do I need to create a txt file and upload? How will the incoming data know where to be placed in data.txt? I have my form working fine with this exception. And Im only looking to store certain fields, like name, email, and phone number. Is this possible?

  370. 1648
    anthony

    attachments not coming through. My mail is coming in with information, but the attachments are not. I tried the recommended change below, but it doesnt help any. We also are trying to have the data stored in data.txt file and that doenst save either. Write permissions have been set to 777 for the data.txt file.
    Any ideas or suggestions on what could be the problem?

    if (!defined('PHP_EOL')) define ('PHP_EOL', strtoupper(substr(PHP_OS,0,3) == 'WIN') ? "\r\n" : "\n");
    
    To this:
    
    if (!defined('PHP_EOL')) define ('PHP_EOL', strtoupper(substr(PHP_OS,0,3) == 'WIN') ? "\n" : "\n");

  371. 1647
    dellvostro

    not sure why the code didnt show. heres a second attempt. I tried placing code within jw

    // FORM STRUCTURE
    // This is used to generate the form. Each form element must be on its own line.
    // Detailed usage instructions can be found on the web page

    $form_struct = ‘
    type=text|class=fmtext|label=Name|fieldname=fm_name|max=100|req=true
    type=text|class=fmtext|label=Email|fieldname=fm_email|max=100|req=true|ver=email
    type=text|class=fmtext|label=Phone|fieldname=fm_phone|max=100|req=true

    type=select|class=fmselect|label=Quantity|fieldname=fm_quantity|req=true|
    data=(select),100,300,500,1000,2500,5000

    type=select|class=fmselect|label=Product Type|fieldname=fm_producttype|req=true|
    data=(select),Stickers,Decals,Labels,Bumper Stickers,Industry Items,Other

    type=text|class=fmtext|label=Item Number|fieldname=fm_itemnumber|max=100|req=true

    type=select|class=fmselect|label=Use|fieldname=fm_use|req=true|
    data=(select),Indoors,Outdoors

  372. 1646
    dellvostro

    Just checked out this fine script and my only bug thus far is having the drop down working correctly.

    I have the typical name, email and phone fields, then drop down menu. I tried copying and pasting the samples given in your instructions and they dont show up either. I get the drop down arrow, but no options are visible. ???

    Other than that the form looks sweet, nice and clean. What could I be doing wrong here? Ill paste the drop down code thats not working below:

    ??ND?E@?Q??8b?+.??m??z??z?^~???!~??zW?z{f??[z????0?X?{??z???n???{-??-???q??y?.??'??y?Z????k-??-

  373. Hello,

    Thanks very much for the updated script. I installed it and modified it according to your instructions, but I’m still getting the “Could not open socket” error when I try to send myself a test message. I posted more details earlier in comment #1633. The PHP e-mail test script works fine, so it must be some other problem, but I can’t figure it out. I’d really appreciate your help – thank you very much!

  374. Hey Admin!
    Thanks for the update, works like a champ!
    The only issue I am having is if I try to put two forms on one page, I get the error:

    
    Fatal error: Cannot redeclare ddfm_hex_to_rgb() (previously declared in /homepages/20/d201884854/htdocs/sunshinedesign/new/form/email.php:227) in /homepages/20/d201884854/htdocs/sunshinedesign/new/form/estimate.php on line 227
    

    Also, what would it take to make all my configurations in one file so I don’t have to redo them every time a new update comes up?

    Thanks for the awesome form!!

  375. I just uploaded a small update. Apparently some of the code used in the new email validation test required PHP 5. It should now work for those of you using PHP 4. Just re-download and let me know how it works for you.

  376. @1640 – JetJagger:
    I am getting the same issue – please let me know if you manage to figure it out.

  377. Hi,

    Great work on this script, I love it! I do however have one question.

    I am working on a form that has 20 check boxes. Once the form is submitted I would like the selected options to be listed on the thank you page (along with the other fields). Is this possible, without having a full list with TRUE or FALSE next to them?

    What I am looking for is basically what comes in the email, but in the success message. I can use the main fields in it, but I am just struggling with the check boxes.

    As a workaround I got it to echo the email to the success message and hacked around with search and replace to make it fit (sort of!). This is not the ideal way I am sure. Do you have any suggestions?

    Keep up the good work!

    Jim

  378. 1640
    JetJagger

    After an hour of reading and basic customization, I installed the application only to see this:

    Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or ‘}’ in /home/hothost/public_html/setup/dd-formmailer/dd-formmailer.php on line 383

    Any solutions?

  379. Version 5.6 has been released!

    This version includes several fixes and new features.

    A javascript date chooser field has been added which displays a nice calendar to select dates (from http://www.nsftools.com/tips/DatePickerTest.htm). Another special field has been added – html – which allows you to easily insert any kind of code into your form.

    Commas can now be used in check boxes, radio buttons, and select boxes. Because commas are used to separate data in these fields, if you want a comma in your text, just use two, and they will be replaced with one before the text is displayed.

    An optional customizable timestamp has been added for those using the ’save to data file’ option.

    A few changes have been made for character support, a bug has been fixed involving spaces in selrecip data, and new (improved) email validation code has been implemented (from http://code.google.com/p/php-email-address-validation/).

    A new language file has also been added: Vietnamese

    WordPress specific updates have also been added for those who also use the plugin version of this script.

  380. Hi. I’d like to thank you for making such a wonderful script and allowing it to be accessed by the general public. It’s very sweet!

    I’m having one problem with this script. When the auto-reply email is sent to Outlook I get extra code before and after the message. It looks like this…

    –2ebbd29ddaa852e5ec9b834bdcaeda6b
    Content-Type: text/plain; charset=utf-8
    Content-Transfer-Encoding: 8bit

    Someone will reply to you shortly.

    –2ebbd29ddaa852e5ec9b834bdcaeda6b–

    I’ve read your trouble shooting page, upgraded from 5.5 to 5.51, and tried just about everything I know how to do.
    Is there a solution to this problem?

    Best regards,
    Chris

  381. Hi, I was wondering if you could provide clues as to how to make one small modification. Is it possible to include the data file that is saved to the server on the email with the other email attachments? So if the user attaches 1 file, the email being sent should include 2 files. The file the user attached and the data.txt file?

    Thanks

  382. Maybe this is a simple question or one that’s been answered before, but I can’t find any reference to it. How do I keep my form populated with the data a user enters after submitting with errors. For example, if a required field is left blank, or if the REcaptcha is incorrect. This is the form I’m working on right now: http://www.nameplatesforindustry.com/dd-inforequest.php

  383. Hi,

    How do I remove this type of extra info appearing in the auto-reply that people are sent when they submit a message?

    –eeecb70ba27992495fc8d1e8bb7c40bc
    Content-Type: text/plain; charset=utf-8
    Content-Transfer-Encoding: 8bit

    I see this before the auto-reply text when I view the auto-reply message.

    Thanks

    Justin

  384. 1634
    alan

    How do you include the Option element and another Input type in the email form?

  385. 1633
    Ryuujin

    Hello,

    Thank you very much for providing such a useful script! I set everything up, but I’m getting a “Could not open socket” error when I try to send a message through the form. I read through your entire article, and one other user (“Geoff”) also mentioned having this error, though I didn’t see any answers to his question. I’m also using Recaptcha (basic doesn’t seem to work on my server because GD can’t be found).

    If it helps, the script is currently in use here:
    http://coconut.milkteahouse.com/dnangel/me.php

    I’ve already tried different e-mail addresses, none of which work, but the test script for PHP mail works fine.

    I’d greatly appreciate your help on this – thanks!

  386. I have items in my forms that have commas (they are prices like $250,000). Is there a way to prevent these commas from creating another item in the list? Basically block the comma separated list from happening in the middle of my prices.

    Thanks

  387. Are you able to have multiple pages of forms so like a Next button that saves all the form data instead of having like 40-50 fields on one page.

  388. 1630
    Jeff

    I currently have phpBB v2 installed and would like a secure form that guests can use to send email to members. Your script looks like the perfect fit – if you can tell me how to pull in a members’ email that is on file in my phpbb database:
    phpbb > phpbb_users > user_email

    Any ideas?
    thanks either way.

  389. Great Script! Moreover I am so happy that you made this script as a wordpress plugin available as well. So I just have to learn the ropes once.

    I got two questions: First, under what license is this script and the plugin?
    Second, could you please extend the above article how to use your script with smtp. I guess most poeple would like to send the form from myfreehostaccountname@freeemailprovider.com.

    Thanks in advance for your feedback.
    Thanks for your effort with this script and the plugin – keep it up!

    Regards
    Jochen

  390. 1628
    lynn

    For those of us with who have hosts that are sensitive to php mail, is there a way to use this with phpmailer? I already have an instance of it on my site for phplist. :)

    MTIA

  391. 1627
    Dave

    How do I keep from sending each message to all recipients, as happens with this coding:

    
    $recipients = 'selrecip to=web@davidgrover.com|to=dc_read@yahoo.com|to=dcr@readwebco.com';
    

    Thanks.

  392. 1626
    mark

    Any easy way to add a date and time stamp to every form entry based on the php time functions? I would like this to be added to the logged data and the prior method suggested in this forum did not work for me.

    Great Script!

  393. 1625
    Mark McCormick

    Do you have any troubleshooting suggestions for logging form submissions? I have $save_to_file = TRUE; and a file wioth proper permissions on the server at $save_path = ‘/log/data.txt’; but I am not getting any logging of data. Any ideas?

  394. 1624
    wai

    Hi , can i know how to change the send mail button to image?
    i change input type = “image” , is work in firefox , but IE cannot work. thank

  395. 1623
    Steve

    @Pete – look inside the ‘lang’ folder for a file called English.php. Open this, either in Dreamweaver or in a text editor.

    Change:
    define('DDFM_SUBMITBUTTON', 'Send Email');
    to
    define('DDFM_SUBMITBUTTON', 'Submit');

    Save it, and upload the changed file to the correct folder.

  396. how do i view the php code in dreamweaver so that i can change the “Send Email” button to read “Submit”?

  397. How do i change the “Send Email” button to read “Submit”?

  398. 1620
    Steve

    @Zoltan (1617) – The script works just great. Perhaps you should get someone else to implement it for you if you lack the skills.