All Discussions - PHP Mail Form Questions & Answers http://www.formmail-maker.com/forum/index.php?p=/discussions/feed.rss Fri, 15 Dec 17 20:25:25 -0500 All Discussions - PHP Mail Form Questions & Answers en-CA How to send a brochure download link in the auto-response email? or download a pdf file on-demand? http://www.formmail-maker.com/forum/index.php?p=/discussion/170/how-to-send-a-brochure-download-link-in-the-auto-response-emails-or-download-a-pdf-file-on-demands Tue, 08 Oct 2013 23:19:01 -0400 admin 170@/forum/index.php?p=/discussions You can probably do it with following steps. See screenshot below for more details.

1) create a drop down with options like this, let's assume the field ID is %field_2%:

- Please Select-=
Brochure 1=brochure1.pdf
Brochure 2=brochure1.pdf
Brochure 3=brochure3.pdf

2) customize your auto-response message, with the the variable %field_2% make up the brochure download link:

Dear %TitleOfSender% %NameOfSender%,

<p>
Thank you for purchasing our product. You can download the brochure with this link: <br>
<a href="http://www.yoursite.com/path/form/%field_2%">Download Brochure</a>

<p>
We will contact you shortly.

<p>
Regards,<br>
Sale Dept.

3) download myform.zip, extract it and upload it to your own website

4) remember to upload all the brochure pdf files to the same folder of your form

5) test your form

Hope it works for you.


]]>
My form runs on HTTPS, but reCaptcha security image doesn't appear in Chrome, why? http://www.formmail-maker.com/forum/index.php?p=/discussion/169/my-form-runs-on-https-but-recaptcha-security-image-doesnt-appear-in-chrome-whys Thu, 20 Jun 2013 12:25:46 -0400 Form User 169@/forum/index.php?p=/discussions Your form is running on HTTPS (SSL) layer, but the reCaptcha security image uses normal HTTP protocol, so the image is blocked by Chrome. You have to use HTTPS for reCaptcha security image.

Edit form.lib.php, replace this line of code:

function phpfmg_show_captcha(){
    if( phpfmg_is_reCAPTCHA() ){
        echo recaptcha_get_html(reCAPTCHA_PUBLIC_KEY);
        return ;
    };
    $url = PHPFMG_ADMIN_URL . '?mod=captcha&amp;func=get&amp;tid=' ;
    $onclick= "onclick=\"document.getElementById('phpfmg_captcha_image').src='{$url}'+Math.random();return false;\" " ;
    echo "<a href='http://www.formmail-maker.com' {$onclick} title=\"Free Mail Form Tool\"><img id=\"phpfmg_captcha_image\" src=\"". $url . time() ."\"  border=0 style=\"cursor:pointer;\" alt=\"Click the image to reload. PHP FormMail Generator at http://phpfmg.sourceforge.net\"></a>\n";
    echo "<a href='http://phpfmg.sourceforge.net' {$onclick} style=\"color:#474747;\" title=\"Reload PHP FormMail Generator Security Image\" >Reload Image</a><br>\n";
    echo "<input type='text' name='fmgCaptchCode' value='' class='fmgCaptchCode' style='width:73px;' >\n";
}


With : 

function phpfmg_show_captcha(){
    if( phpfmg_is_reCAPTCHA() ){
        echo recaptcha_get_html(reCAPTCHA_PUBLIC_KEY, null, true);
        return ;
    };
    $url = PHPFMG_ADMIN_URL . '?mod=captcha&amp;func=get&amp;tid=' ;
    $onclick= "onclick=\"document.getElementById('phpfmg_captcha_image').src='{$url}'+Math.random();return false;\" " ;
    echo "<a href='http://www.formmail-maker.com' {$onclick} title=\"Free Mail Form Tool\"><img id=\"phpfmg_captcha_image\" src=\"". $url . time() ."\"  border=0 style=\"cursor:pointer;\" alt=\"Click the image to reload. PHP FormMail Generator at http://phpfmg.sourceforge.net\"></a>\n";
    echo "<a href='http://phpfmg.sourceforge.net' {$onclick} style=\"color:#474747;\" title=\"Reload PHP FormMail Generator Security Image\" >Reload Image</a><br>\n";
    echo "<input type='text' name='fmgCaptchCode' value='' class='fmgCaptchCode' style='width:73px;' >\n";
}

Save the form.lib.php file, and upload it back to your server. It should work.
]]>
My form uses security image, and the "Please check the required fields" shows all the time. Why? http://www.formmail-maker.com/forum/index.php?p=/discussion/168/my-form-uses-security-image-and-the-please-check-the-required-fields-shows-all-the-time.-whys Thu, 30 May 2013 12:54:02 -0400 admin 168@/forum/index.php?p=/discussions You create a form, download the myform.zip file, and upload all php files to your website, but "Please check the required fields" keeps showing up regardless you fill in all required fields. The reason is the PHP session. Your web server's php session config might have some problems. 

To fix this "problem", please try one of the followings :

1) If you know how to change the session config in php.ini, probably the variable session.save_path, then please make sure the folder's permission is writable by web user

2) set the session.save_path to system's temp folder in form.lib.php. just copy the highlight block of code, and paste it to form.lib.php as below:



# PHPFMG_ID:'20110812-77e0'
# Date : 20110812 20:08:13
# Generated By Free PHP Formmail Generator : http://phpfmg.sourceforge.net
# -----------------------------------------------------------------------------
define( 'PAYPAL_ID' , '' ); // Put donation ID here to disable the copyright link

define( 'PHPFMG_TO' , 'abc@test.com' );
define( 'PHPFMG_REDIRECT', '' );

define( 'PHPFMG_ID' , '20110812-77e0' );
define( 'PHPFMG_ROOT_DIR' , dirname(__FILE__) );
define( 'PHPFMG_SAVE_FILE' , PHPFMG_ROOT_DIR . '/form-data-log.php' ); // save submitted data to this file
define( 'PHPFMG_EMAILS_LOGFILE' , PHPFMG_ROOT_DIR . '/email-traffics-log.php' ); // log email traffics to this file
define( 'PHPFMG_ADMIN_URL' , 'admin.php' );

if( !is_writable( ini_get('session.save_path') ) && is_writable(PHPFMG_ROOT_DIR) ){
ini_set( 'session.save_path', PHPFMG_ROOT_DIR );
};

define( 'PHPFMG_SAVE_ATTACHMENTS' , 'Y' );
define( 'PHPFMG_SAVE_ATTACHMENTS_DIR' , PHPFMG_ROOT_DIR . '/uploaded/' );


3) if you can't do 1) method, or the 2) doesn't work for you, then you can login your form admin panel (admin.php), click the "edit form" link to re-generate the form by using reCaptcha method

4) or do not use any catpcha security image method for your form

I suggest you fix the php session problem, otherwise, even the form works, but you won't be able to view or download form data. Because of the php session has problem, it can not keep your login session, so you will be redirected to the login form again.


]]>
SMTP Setting for AOL http://www.formmail-maker.com/forum/index.php?p=/discussion/44/smtp-setting-for-aol Fri, 06 Jul 2012 12:06:00 -0400 admin 44@/forum/index.php?p=/discussions A AOL email user shared his SMTP setting for the email form:

SMTP host: smtp.aol.com


SMTP user: your aol email address i.e. aolscreenname@aol.com
 
SMTP password: your aol login password
 
SMTP port: 587
 
SMTP security: None
]]>
My form can't upload large size files, please help? http://www.formmail-maker.com/forum/index.php?p=/discussion/25/my-form-cant-upload-large-size-files-please-helps Sun, 22 Apr 2012 23:13:31 -0400 admin 25@/forum/index.php?p=/discussions php.

The php default value of
upload file size limitation is 2M.  If you want your web form uploading large size files, you have to change memory_limit, post_max_size  and upload_max_filesize 
variables in php.ini file . Those variables can  ONLY be set on server side file php.ini. Here the example :

;Maximum amount of memory a script may consume
memory_limit = 40M 

; Maximum size of POST data that PHP will accept.
post_max_size = 40M

; Maximum allowed size for uploaded files.
upload_max_filesize = 10M

please change the values of above variables as needed.

If you use a shared hosting server, and you can't edit the php.ini file, please contact your
hosting tech support.




]]>
How to load a PHP form in Joomla? http://www.formmail-maker.com/forum/index.php?p=/discussion/24/how-to-load-a-php-form-in-joomlas Wed, 07 Mar 2012 15:18:30 -0500 admin 24@/forum/index.php?p=/discussions I would like to thank Mark (G9 Capital). He is very kind to provide a very detailed instructions. Enjoy!

I needed a Joomla extension to handle a PHP form and the best one I found
is called “Jumi”
Jumi is very simple to download and it can be found at this link http://extensions.joomla.org/extensions/edition/custom-code-in-content/1023

Instructions are:

1) Download the Jumi extension.

2) Open the Jumi program from the list of extensions in your website.

3) You will see two examples, then just click “New” and enter a name for
your form.

4) You can ignore all other fields, simply go to where it says “pathname”
and enter the name of your form, ie websiteformname/form.php

5) Click “Save”

That’s it, your PHP FormMail Generator form should now work flawlessly in
your website. You can see my form at this link http://g9capital.com/index.php?option=com_jumi&fileid=3&Itemid=148

 

The above instructions of course apply to your form only although I am sure
others would work pretty much the same. A very similar method would work for
Joomla and Wordpress sites.

 

I hope this helps and thanks again.

 

Mark
]]>
How to make a popup form using jQuery and ColorBox plugin? http://www.formmail-maker.com/forum/index.php?p=/discussion/23/how-to-make-a-popup-form-using-jquery-and-colorbox-plugins Sun, 26 Feb 2012 18:54:40 -0500 admin 23@/forum/index.php?p=/discussions New Form Tool: Try new jQuery Bootstrap Form Builder to create beautiful web forms!

It's easy to make a popup contact form looks like this :

image

Try Demo :
Popup Form Demo Link



Here is the source code. All the important parts are highlighted.

<!DOCTYPE html>
<html>
    <head>
        <meta charset='utf-8'/>
        <title>Example : a popup contact form using jQuery and ColorBox plugin </title>

        <link rel="stylesheet" href="http://www.formmail-maker.com/var/demo/jquery-popup-form/colorbox.css" />
        <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
        <script src="http://www.formmail-maker.com/var/demo/jquery-popup-form/jquery.colorbox-min.js"></script>

        <script>
            $(document).ready(function(){
                $(".iframe").colorbox({iframe:true, fastIframe:false, width:"450px", height:"480px", transition:"fade", scrolling   : false});
            });
        </script>
       
       
        <style>
            #cboxOverlay{ background:#666666; }
        </style>
               
    </head>
   
    <body>
   
        <h4>A Popup Email Form Demonstration</h4>
        To make a popup form is easy. All you need is to make a form at <a href="http://www.formmail-maker.com">formmail-maker.com</a>, then use jQuery and ColorBox plugin to make it pop.
        <p /><p />
        <p><h3>Click here for the popup form demo : <a class='iframe' href="http://www.formmail-maker.com/var/demo/jquery-popup-form/form.php">Contact Us</a></h3></p>



    </body>
</html>
]]>
Translate Title of Sender to German in Email Form http://www.formmail-maker.com/forum/index.php?p=/discussion/22/translate-title-of-sender-to-german-in-email-form Tue, 18 Oct 2011 14:37:53 -0400 admin 22@/forum/index.php?p=/discussions
<li class='field_block' id='field_0_div'><div class='col_label'>

    <label class='form_field'>Title</label> <label class='form_required' >*</label> </div>

    <div class='col_field'>

    <?php phpfmg_dropdown( 'field_0', "Mr.|Mrs.|Ms.|Miss" );?>

    <div id='field_0_tip' class='instruction'></div>

    </div>

</li>

It can be translated to your own language, like German here :

<li class='field_block' id='field_0_div'><div class='col_label'>
    <label class='form_field'>Titel</label> <label class='form_required' >*</label> </div>
    <div class='col_field'>
    <?php phpfmg_dropdown( 'field_0', "Frau|Herr" );?>
    <div id='field_0_tip' class='instruction'></div>
    </div>
</li>


]]>
How to save form data to MySQL database? http://www.formmail-maker.com/forum/index.php?p=/discussion/21/how-to-save-form-data-to-mysql-databases Tue, 18 Oct 2011 14:25:27 -0400 admin 21@/forum/index.php?p=/discussions You need to make up sql query based on the form field/value pairs. You can probably do something like this in form.lib.php :

1) manually add "dbfield" name to map the form field name with mysql table field

2) get the query read of name/value pairs

$GLOBALS['form_mail'] = array();
$GLOBALS['form_mail']['field_0'] = array( "name" => "field_0", "text" => "smtp",  "type" => "", "instruction" => "", "required" => "" ) ;
$GLOBALS['form_mail']['field_1'] = array( "name" => "field_1", "dbfield" => "email", "text" => "Email",  "type" => "sender's email", "instruction" => "Your email address", "required" => "Required" ) ;
$GLOBALS['form_mail']['field_2'] = array( "name" => "field_2", "dbfield" => "title", "text" => "Title",  "type" => "titleofsender", "instruction" => "Your title", "required" => "Required" ) ;
$GLOBALS['form_mail']['field_3'] = array( "name" => "field_3", "text" => "Name",  "type" => "sender's name", "instruction" => "", "required" => "Required" ) ;
$GLOBALS['form_mail']['field_4'] = array( "name" => "field_4", "text" => "Section Break Text Goes Here",  "type" => "sectionbreak", "instruction" => "", "required" => "Not Required" ) ;
$GLOBALS['form_mail']['field_5'] = array( "name" => "field_5", "text" => "Generic Email",  "type" => "generic email", "instruction" => "", "required" => "" ) ;

....

function phpfmg_getSQL(){
    $dbFields = array();
    foreach( $GLOBALS['form_mail'] as $field ){
        if( isset($field["dbfield"]) ){
            $value = phpfmg_field_value( $field[ "name" ] );
            $dbFields[] = "`{$field['dbfield']}` = \"" . mysql_escape_string( $value ) . "\"";
        };
    }
    return join(",", $dbFields);
}

3) after the mail sent, use the above function phpfmg_getSQL() to get the query string to make up a complete insert query, then execute the query to insert the form data to MySQL


]]>
I don't want to use iframe. How can I embed the form directly? http://www.formmail-maker.com/forum/index.php?p=/discussion/20/i-dont-want-to-use-iframe.-how-can-i-embed-the-form-directlys Fri, 07 Oct 2011 12:19:47 -0400 admin 20@/forum/index.php?p=/discussions
<?php require_once( dirname(__FILE__).'/form.lib.php' ); ?>
<html>
<head>
</head>
<body>

  <div id='header'>
  My site header
  </div>

  <div id="contactForm">
  <?php
  $GLOBALS['formOnly'] = true;
  include('form.php');
  ?>
  </div>

  <div id='footer'>
  My site fotter
  </div>

</body>
</html>

Your contact form will has your own page design and my functional email form.

]]>
How to specific From Name and Email Address for auto-response message? http://www.formmail-maker.com/forum/index.php?p=/discussion/17/how-to-specific-from-name-and-email-address-for-auto-response-messages Mon, 26 Sep 2011 18:44:54 -0400 admin 17@/forum/index.php?p=/discussions
1) click option : Customize email & auto-response message
2) then click option : More auto-response options

See screen shot below for details :


image


or edit form.lib.php directly, for example :



// for auto-response email

define( 'PHPFMG_YOUR_NAME' , 'Sales' ); // name of auto-response mail address

define( 'PHPFMG_RETURN_EMAIL' , "sales@yourwebsite.com" ); 



]]>
How secure are the email form and my form data? http://www.formmail-maker.com/forum/index.php?p=/discussion/16/how-secure-are-the-email-form-and-my-form-datas Sat, 24 Sep 2011 21:29:49 -0400 admin 16@/forum/index.php?p=/discussions I'm confident that all the web forms downloaded from my website (formmail-maker.com) are safe and spam free. Each web form has following methods to fight with spammers and potential hackers:

  1. No email address embedded in form html source
  2. Use simple built-in security image or use very secured reCAPTCHA project of Google
  3. Check email header injections
  4. File upload control to check harmful files 
  5. Save form data in php to avoid unauthorized download
  6. Host the form on your own website, not third-party

No email address embedded in form html source


Unlike old fashion formmail solutions, like formmail.pl and formmail.php, you need to embed the email address to make it work. The email address will be collected by email spider for email spammers.  My form uses predefined email address as the formmail recipient in php script form.lib.php. So no spammer can get your email address for spamming. The predefined email address in form.lib.php looks like this :

define( 'PHPFMG_TO' , 'you@yourwebsite.com' );

Use simple built-in security image or use very secured reCAPTCHA project of Google


For the security image of web form, you can choose one of  3 options : no security image, simple built-in 4 characters security image, or reCAPTCHA project of Google. The built-in security image doesn't require server side GD library. The screen shot of security image used by the web form :


image


Check email header injections


The forms downloaded from my website have built-in header injection check. In the form, there are several places to stop the email headers being injected :
1) The email addresses ( TO, CC, BCC ) of the form are predefined, and they can't be harvested by email spider
2) The "email of sender" and "name of sender" special fields in the form will be checked the injection. Special chars usually used by the email header injection will be removed. The special chars include linebreaks, comma (,), semicolon (;), "CC:", and "BCC:". This is to stop spammer using CC: and BCC: for spamming.
3) the body of message will always print the form field label first, not the content submitted by user. this is to stop email headers being injected by well crafted user content.
4) has built-in security image captcha code, the reCAPTCHA is also available to stop the form being submitted by spambot
5) there are email log on the server, the log will show whether there are any unusual email traffics

It should be spam free by using above methods. There is no report that forms are being abused so far.

File upload control to check harmful files


There are file upload control options for the web form to block harmful files being uploaded. The harmful files are executable applications and scripts on Windows platform or on the web server platform.  See the screen shot to see the form blocks harmful file on the browser side :


image

On the email attachments and the server side, harmful uploaded files are also being handled.  After I read a article about php file upload security  (http://www.scanit.be/uploads/php-file-upload.pdf),  I'm very confident that my form file upload handling is very secure, or at least, there is no security holes as described in that article. 

Long in short, in order to use php attack, hacker will have :
1) a php file (back door) upload to your server
2) the web path of the php file
3) or any other file (.gif, .html, .js, .css, etc...) that will be executed as php file because of the server side setting

In my form file upload handling, a uploaded file will be handled as following ways:
1) all upload files will be renamed with a random id prefix to the file name
2) if a file is harmful, it will be also renamed its file extension as .bak. For example, if someone uploads a backdoor web php script phpshell.php through the web form, it will be renamed as something like 20110924-97c6-phpshell.php.bak on the server side and on the email attachment. 
3) option to save files out of the webroot in form.lib.php as following :

define( 'PHPFMG_ROOT_DIR' , dirname(__FILE__) );
define( 'PHPFMG_SAVE_FILE' , PHPFMG_ROOT_DIR . '/form-data-log.php' ); // save submitted data to this file
define( 'PHPFMG_EMAILS_LOGFILE' , PHPFMG_ROOT_DIR . '/email-traffics-log.php' ); // log email traffics to this file
define( 'PHPFMG_ADMIN_URL' , 'admin.php' );

define( 'PHPFMG_SAVE_ATTACHMENTS' , 'Y' );
define( 'PHPFMG_SAVE_ATTACHMENTS_DIR' ,  '/secured-folder/uploaded/' );


Save form data in php to avoid unauthorized download


The form data will be saved in as a php file form-data-log.php. The file uses php exit() function to avoid your form data being downloaded as text file. Here is the example :

<?php exit(); /* For security reason. To avoid public user downloading below data! */?>
"RecordID" "Date" "IP" "Your name:" "Your email:" "Did it work on my website when you built the form?" "Have you read the F.A.Q?" "Did you modify the form?" "The link of the form which it does not work on your website." "Attach a zip file with all php files of your form, it will help us to fix the problem quickly." "Details of problem:"
"20100206-c327" "2010-02-06 18:26:07" "67.135.237.178" "Tester" "tester@test.com" "Yes" "Yes" "No" "" "" ""

Host the form on your own website, not third-party web form service providers


You host your form on your own website, not form service providers. No need to worry your form data will be abused. You create the form on my website and download your form as myform.zip, then you unzip them and upload to your own website. No data or any
communication will be sent to my website. It's all yours once you put it
to your website. 



As a result, the form and your form data are safe and secure!


If you happen to find any security problems, please let me know. I will be more than happy to
fix any security issues in the email form maker.

:)

]]>
Make email form not be cached by browsers and proxy servers http://www.formmail-maker.com/forum/index.php?p=/discussion/15/make-email-form-not-be-cached-by-browsers-and-proxy-servers Thu, 22 Sep 2011 16:48:10 -0400 admin 15@/forum/index.php?p=/discussions Question:

I would like to make sure the web browser does not store the form in
cache. What shall I add to the code to make sure the browser gets code
every time

Answer:

In form.lib.php, you can add the following highlighted code to force the form not be cached by browser or proxy :

function phpfmg_init(){

  error_reporting( E_ERROR );
  ini_set('magic_quotes_runtime', 0);
  ini_set( 'max_execution_time', 0 );
  ini_set( 'max_input_time', 36000 );
  session_start();
  phpfmg_check_referers();

  if ( get_magic_quotes_gpc() && isset($_POST) ) {
      phpfmg_stripslashes( $_POST );
  };
 
  phpfmg_no_cache();
 
}

function phpfmg_no_cache(){
    $expired = gmdate( "D, d M Y H:i:s", time()-1800 ) . " GMT"; // 1800 seconds ago
    header("Expires: " . $expired );
    header("Last-Modified: " .$expired );
    header("Cache-Control: post-check=0, pre-check=0, max-age=0, no-store, no-cache, must-revalidate");
    header("Pragma: no-cache");
}

Please remember to upload the updated file back to your website.

You might also want to read below information. I copied it from http://php.net/manual/en/function.header.php :

You may find that your pages aren't cached even if you don't
output all of the headers above. There are a number of options
that users may be able to set for their browser that change its
default caching behavior. By sending the headers above, you should
override any settings that may otherwise cause the output of your
script to be cached.



Additionally, session_cache_limiter() and
the session.cache_limiter configuration
setting can be used to automatically generate the correct
caching-related headers when sessions are being used.



]]>
My form has upload fields. Will hackers upload backdoor scripts to my website? Is my form secure? http://www.formmail-maker.com/forum/index.php?p=/discussion/14/my-form-has-upload-fields.-will-hackers-upload-backdoor-scripts-to-my-websites-is-my-form-secures Wed, 21 Sep 2011 12:58:12 -0400 admin 14@/forum/index.php?p=/discussions Question:

There are security problems in some email form written in php languages. I read this article and know about the security problem in php file upload at http://www.scanit.be/uploads/php-file-upload.pdf. My form has upload fields. Will hackers upload backdoor scripts to my website? Is my form secure?

Answer:

Thank you for the article link. I read along the articles, and I'm very confident that my form file handling is very security. or at least, there is no security holes as described in those articles, especially this article at http://www.scanit.be/uploads/php-file-upload.pdf.

Long in short, in order to use php attack, hacker will have ( see screen shot for the highlight ):
1) a php file (back door) upload to your server
2) the web path of the php file
3) or any other file (.gif, .html, .js, .css, etc...) that will be executed as php file because of the server side setting

In my form file upload handling, a uploaded file will be handled as following:
1) renamed with a random id prefix to the file name
2) if the file is harmful, it will be also renamed with .bak
3) I guess no server will execute .bak as php file
4) option to save files out of the webroot in form.lib.php.

define( 'PHPFMG_ROOT_DIR' , dirname(__FILE__) );
define( 'PHPFMG_SAVE_FILE' , PHPFMG_ROOT_DIR . '/form-data-log.php' ); // save submitted data to this file
define( 'PHPFMG_EMAILS_LOGFILE' , PHPFMG_ROOT_DIR . '/email-traffics-log.php' ); // log email traffics to this file
define( 'PHPFMG_ADMIN_URL' , 'admin.php' );

define( 'PHPFMG_SAVE_ATTACHMENTS' , 'Y' );
define( 'PHPFMG_SAVE_ATTACHMENTS_DIR' ,  '/secured-folder/uploaded/' );

As a result, the form file upload should have no security problems. If you happen to find any, please let me know. I will be more than happy to fix any security issues in the email form maker.
]]>
How to save my email form data in a secure folder (not part of web root folder)? http://www.formmail-maker.com/forum/index.php?p=/discussion/13/how-to-save-my-email-form-data-in-a-secure-folder-not-part-of-web-root-folders Wed, 21 Sep 2011 12:37:20 -0400 admin 13@/forum/index.php?p=/discussions form data and log are created and handle
with security in mind. It should not be able to grab without login. If
you want it more securer, you can config the script to store the data
out of the website structure. You can edit the form.lib.php as the following example :


define( 'PHPFMG_SAVE_FILE' ,  '/secure-folder-here/form-data-log.php' ); // save submitted data to this file
define( 'PHPFMG_EMAILS_LOGFILE' , '/secure-folder-here/email-traffics-log.php' ); // log email traffics to this file

]]>
Knowing emails sent by which email form page using variables %FormPageLink% and %HTTP_REFERER% http://www.formmail-maker.com/forum/index.php?p=/discussion/12/knowing-emails-sent-by-which-email-form-page-using-variables-formpagelink-and-http_referer Tue, 20 Sep 2011 12:57:22 -0400 admin 12@/forum/index.php?p=/discussions Question:

I have a little question: can I put at the subject form a code so that when I receive a message from my website, helps me know in which page is at that moment the user? For example: "Offer request for the product located at this page: ...(refurl)..."
I mention that I use this form in several different pages and I need to know from which page it comes.

Thank you in advance!

Answer:

There are variables for email subject and body content. Here is the list of all the variables you can use :

'%NameOfSender%'
'%FirstNameOfSender%'
'%LastNameOfSender%'
'%EmailOfSender%'
'%TitleOfSender%'
'%DataOfForm%'
'%IP%'
'%Date%'
'%Time%'
'%HTTP_HOST%'
'%FormPageLink%'
'%HTTP_REFERER%'
'%AutoID%'

In your case, please use '%HTTP_HOST%', %FormPageLink%, and %HTTP_REFERER% as need. See following screen shot for details :


image]]>
Use web form to send emails to CC or BCC based on the input value of form field http://www.formmail-maker.com/forum/index.php?p=/discussion/11/use-web-form-to-send-emails-to-cc-or-bcc-based-on-the-input-value-of-form-field Thu, 15 Sep 2011 12:43:23 -0400 admin 11@/forum/index.php?p=/discussions Question :

I've been using your PHP Form Creator very successfully for several months now on many projects.



After implementing my latest form, it was brought to my attention that
it would be useful when filling out the form to be able to CC 1 or more
people when the form is completed.



I setup the generic email field, but I don't know how to convert it to the PHPFMG_CC.



How do I this and where do I put the code?

Answer :

Instead of using predefined value for email's CC or BCC field, the web form can use a dynamic field value input by user. Here are the steps :
1) get the field name or field ID of the field from form.php, let's use "field_1" as example.

2) then change one line code in form.lib.php as following :
    define( 'PHPFMG_CC' , phpfmg_field_value('field_1') );

3) upload the form.lib.php back to your website to test the form mail

See the screen shot below for details:


image



For the dynamic email TO field, please read here : Can a form send email to a different email address depends on dropdown options?]]>
How to change the auto generated reference number for the email form and the form data records? http://www.formmail-maker.com/forum/index.php?p=/discussion/10/how-to-change-the-auto-generated-reference-number-for-the-email-form-and-the-form-data-recordss Fri, 01 Apr 2011 15:54:31 -0400 admin 10@/forum/index.php?p=/discussions
function phpfmg_getRecordID(){
    if( !isset($GLOBALS['RecordID']) ){
        $GLOBALS['RecordID'] = date("Ymd") . '-'.  substr( md5(uniqid(rand(), true)), 0,4 );
    };
    return $GLOBALS['RecordID'];
}

You can change the reference number by replacing the highlighted code above with your own code.

If you only want to change the auto generated number for the email message. You can change it at the following code :

    // ... skip ...

    $RecordID  = phpfmg_getRecordID();

    // ... skip ...


    $_fields = array(
        '%NameOfSender%' => $fromName,
        '%FirstNameOfSender%' => $firstName,
        '%LastNameOfSender%' => $lastName,
        '%EmailOfSender%' => $from,
        '%TitleOfSender%' => $titleOfSender,
        '%DataOfForm%'   => $content,
        '%IP%'   => $_SERVER['REMOTE_ADDR'],
        '%Date%'   => date("Y-m-d"),
        '%Time%'   => date("H:i:s"),
        '%AutoID%' => $RecordID,
    );

The $_fields variable is only for the email message, not for the form data records. You can also add your own new variables to here, then use them to your email message template. For example, you want to add a new variable %MyWebSite% like this :

    $_fields = array(

   '%NameOfSender%' => $fromName,

   '%FirstNameOfSender%' => $firstName,

   '%LastNameOfSender%' => $lastName,

   '%EmailOfSender%' => $from,

   '%TitleOfSender%' => $titleOfSender,

   '%DataOfForm%'   => $content,

   '%IP%'   => $_SERVER['REMOTE_ADDR'],

   '%Date%'   => date("Y-m-d"),

   '%Time%'   => date("H:i:s"),

   '%AutoID%' => $RecordID,

   "%MyWebSite%" => "http://" . $_SERVER['HTTP_HOST'],
    );



Then use the variable for the email template :

Dear %TitleOfSender% %NameOfSender%,

Thank you for purchasing our product. Here is the copy of your order:
%DataOfForm%

We will contact you shortly.

Regards,
Sale Dept.

IP: %IP%
Date: %Date%
Time: %Time%
Reference ID: %AutoID%
My website address : %MyWebSite%

The email message will be replaced with the value you defined above.

]]>
Can a form send email to a different email address depends on dropdown options? http://www.formmail-maker.com/forum/index.php?p=/discussion/9/can-a-form-send-email-to-a-different-email-address-depends-on-dropdown-optionss Sat, 26 Mar 2011 19:44:12 -0400 admin 9@/forum/index.php?p=/discussions 1) create a normal dropdown field with options, e.g. : Sales, Support, Customer Service
2) then download the form php files, edit the form.lib.php as the following,  just before the  'PHPFMG_TO' line :



function get_to(){
    $to = array(
        'Sales' => 'a@sympatico.ca',
        'Support' => 'b@gmail.com',


        'Customer Service' => 'c@hotmail.com',
    );
    $default = 'b@gmail.com';
    return isset( $_POST['field_?'] ) && !empty($to[ $_POST['field_?'] ])  ? $to[ $_POST['field_?'] ]: $default;


  
}

define( 'PHPFMG_TO' , get_to() );

please replace the field_? with the real field name. In my case, I got the field name field_2 from the form.lib.php :


# --- Array of Form Elements ---
$GLOBALS['form_mail'] = array();
$GLOBALS['form_mail']['field_0'] = array( "name" => "field_0", "text" => "Your Name",  "type" => "sender's name", "instruction" => "", "required" => "Required" ) ;
$GLOBALS['form_mail']['field_1'] = array( "name" => "field_1", "text" => "EMail",  "type" => "sender's email", "instruction" => "", "required" => "Required" ) ;
$GLOBALS['form_mail']['field_2'] = array( "name" => "field_2", "text" => "Department You Want to Contact",  "type" => "select", "instruction" => "", "required" => "Required" ) ;
$GLOBALS['form_mail']['field_3'] = array( "name" => "field_3", "text" => "Message",  "type" => "textarea", "instruction" => "", "required" => "Required" ) ;

See screen shot below:
image
]]>
How to use dependent drop down boxes values to make a dynamic email subject line? http://www.formmail-maker.com/forum/index.php?p=/discussion/8/how-to-use-dependent-drop-down-boxes-values-to-make-a-dynamic-email-subject-lines Tue, 22 Mar 2011 16:47:25 -0400 admin 8@/forum/index.php?p=/discussions From User:

I'm trying to figure out a way to make the Subject of the email be dependent upon a couple of dependent drop down boxes.

So that I can have it generate a different subject based on what drop down is selected.

For example the way i need to use it is where the user picks a contest. So currently there are two contests going on. contest A is for 'Sucker Punch' and contest B is for 'Source Code'. Those are the two main drop box selections. Then Under Contest A there are selections 'Tampa' and 'Miami'. Under contest B there are selections 'Miami', 'Orlando', 'Jacksonville', 'West Palm Beach', and 'Tampa'. So I want the email that is generated upon entering the contest to have a subject of "Sucker Punch - Miami" or "Source Code - Orlando" depending on what the user selects.

Do you know an easy way to patch that into the existing code?


Answer:

Yes. You can do it without any "patch". This is a built-in feature in the php email form script you downloaded. All the form fields' value can be used for the email you received and the auto-response email for the user. The fields' value will be passed to the email subject line and the email body. So you complete customize the email message and subject line.

Here are the steps :
1) get the field name of the dependent dropdown by "View Source" of the form script. so in my case, the "field_4_0" and "field_4_1" are the field names of the dropdowns

image

2) use variable of "%field_4_0" and "%field_4_1%" for the email subject line or the email body as you need


image

3) then regenerate the form to test the email, here is the email I got from this email example


image]]>
Why I receive email with username and password sent by the Form Admin Panel? http://www.formmail-maker.com/forum/index.php?p=/discussion/7/why-i-receive-email-with-username-and-password-sent-by-the-form-admin-panels Tue, 22 Mar 2011 16:09:09 -0400 admin 7@/forum/index.php?p=/discussions
I have changed the "forgot password" process for the email form admin panel. A email verification from will be shown before sending email of the account information. So the new form will not have the problem again.

In order to fix the unrequested email for the old forms,  two methods can be used to fix the problem completely :

1) edit the admin.php manually, remove the following mailing password function completely :

function phpfmg_mail_password(){
    phpfmg_admin_header();
    if( defined( 'PHPFMG_USER' ) && defined( 'PHPFMG_PW' ) ){
        $body = "Here is the password for your form admin panel:\n\nUsername: " . PHPFMG_USER . "\nPassword: " . PHPFMG_PW . "\n\n" ;
        if( 'html' == PHPFMG_MAIL_TYPE )
            $body = nl2br($body);
        mailAttachments( PHPFMG_USER, "Password for Your Form Admin Panel", $body, PHPFMG_USER, 'You', "You <" . PHPFMG_USER . ">" );
        echo "<center>Your password has been sent.<br><br><a href='admin.php'>Click here to login again</a></center>";
    }; 
    phpfmg_admin_footer();
}

2) or login to admin.php to re-generate the form, and use the new admin.php to replace your old one. Because I change the whole process on the "forgot password". It will verify the email first before sending the password. See screen shot for detail.



image]]>
How to display Radio and Checkbox options at the same line? http://www.formmail-maker.com/forum/index.php?p=/discussion/6/how-to-display-radio-and-checkbox-options-at-the-same-lines Thu, 10 Mar 2011 17:33:27 -0500 admin 6@/forum/index.php?p=/discussions From User:

I have a list of 5 check boxes. They are currently displayed one per line, and I want them to be in a row across the page. Is this an easy fix?

Answer:

Yes. You can just use one line of css to hide the <br> tags. For example, you have a checkbox field like this :

<li class='field_block' id='field_8_div'><div class='col_label'>
    <label class='form_field'>Checkboxes</label> <label class='form_required' >&nbsp;</label> </div>
    <div class='col_field'>
    <?php phpfmg_checkboxes( 'field_8', "Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday" );?>
    <div id='field_8_tip' class='instruction'></div>
    </div>
</li>

You can edit css in the form.php, just add the following css :

#field_8_div br{
    display:none;
}

It will do the trick. See the screenshot here :

image]]>
How to change Year dropdown with dynamic future year for the email form? http://www.formmail-maker.com/forum/index.php?p=/discussion/5/how-to-change-year-dropdown-with-dynamic-future-year-for-the-email-forms Thu, 10 Mar 2011 16:28:25 -0500 admin 5@/forum/index.php?p=/discussions Question From User:

One last question, when I add a date section. How do I make it add years instead of subtract? I changed the -100 to +100 but then then nothing shows up in the drop down except the yyyy.

Answer:

You can edit the form.php as the following
highlight to the date field :

<li class='field_block' id='field_0_div'><div class='col_label'>
    <label class='form_field'>From</
label> <label class='form_required' >&nbsp;</label> </div>
    <div class='col_field'>
    <?php
selectList( "field_0_MM", $_POST["field_0_MM"], 1, 12, "MM", $style ) ;
selectList( "field_0_DD", $_POST["field_0_DD"], 1, 31, "DD", $style ) ;
selectList( "field_0_YYYY", $_POST["field_0_YYYY"], date("Y"), date("Y")+2, "YYYY", $style ) ;
?>

The date("Y") means current year which is 2010, the date("Y")+2 means the next 2 years which is 2012. When the year 2011 comes, the drop down will be 2011 to 2013.
]]>
How to display Date dropdown in German format in the PHP form? http://www.formmail-maker.com/forum/index.php?p=/discussion/4/how-to-display-date-dropdown-in-german-format-in-the-php-forms Thu, 10 Mar 2011 16:17:19 -0500 admin 4@/forum/index.php?p=/discussions From User:

First of all: fantastic feature! After searching the web for hours I was glad to find (almost) exactly what I need. Except for the following: I need to change the dropdown menu for the date. Required are dates in the future. I tried to adjust the form.php file where the php-code is inserted - without success. Also I would like to put another date format (TT.MM.JJJJ) and the according labels in the form as the website is in German. I would be very glad if you could help me with that.

Answer:

You need to change 2 things. One is to display the date in German format TT.MM.JJJJ; The other is to change the year dropdown to the future years.

The following code is from your attached php form file.  You can change the the following code :

change this :

<li class='field_block' id='field_2_div'><div class='col_label'>
    <label class='form_field'>Baubeginn</label> <label class='form_required' >&nbsp;</label> </div>
    <div class='col_field'>
    <?php
selectList( "field_2_MM", $_POST["field_2_MM"], 1, 12, "MM", $style ) ;
selectList( "field_2_DD", $_POST["field_2_DD"], 1, 31, "DD", $style ) ;
selectList( "field_2_YYYY", $_POST["field_2_YYYY"], date("Y")-100, date("Y"), "YYYY", $style ) ;
?>

    <div id='field_2_tip' class='instruction'></div>
    </div>
</li>


to this :

<li class='field_block' id='field_2_div'><div class='col_label'>
    <label class='form_field'>Baubeginn</label> <label class='form_required' >&nbsp;</label> </div>
    <div class='col_field'>
    <?php
selectList( "field_2_DD", $_POST["field_2_DD"], 1, 31, "TT", $style ) ;
selectList( "field_2_MM", $_POST["field_2_MM"], 1, 12, "MM", $style ) ;
selectList( "field_2_YYYY", $_POST["field_2_YYYY"], date("Y"), date("Y")+10, "JJJJ", $style ) ;
?>

    <div id='field_2_tip' class='instruction'></div>
    </div>
</li>

The date("Y") means current year which is 2010, the date("Y")+10 means the next 10 years which is 2021. When the next year 2012 comes, the drop down options will be 2012 to 2022.

The dropdown looks like the screen shot here :



image]]>
The wrong email field causes the sender of the email form doesn't receive auto-response email. http://www.formmail-maker.com/forum/index.php?p=/discussion/3/the-wrong-email-field-causes-the-sender-of-the-email-form-doesnt-receive-auto-response-email.- Wed, 09 Mar 2011 06:18:20 -0500 admin 3@/forum/index.php?p=/discussions From User:

The form is loading fine but once the user enters their information, I get both MY copy of their booking AND theirs. The user isn't receiving any email - I'm getting both. How can I fix it so it works normally and both the user AND I get a copy of the form? Thanks in advance :)


Answer:

In order to send a auto response email message to sender, the form requires a special form field - Email of sender. Under the "Sender Information" group, the "Email" field is used for filling up the email header "From:" information.

From the file you sent me, your form doesn't have that special email field. It only has "Generic Email" field, not "Email" of sender. please login your form admin panel, the click the "edit form" to change the "Generic Email" field to "Email" of sender. remember to download the modify form and put it back to your website.

See the screen shot for details:

image]]>
Variables for Email Subject and Message http://www.formmail-maker.com/forum/index.php?p=/discussion/2/variables-for-email-subject-and-message Tue, 08 Mar 2011 23:26:10 -0500 admin 2@/forum/index.php?p=/discussions Question:

Implementation and use of the generator was childsplay! Very
awesome generator, extremely useful if you need a form and need it fast,
therefore cofffee + i will be recommending this to friends.

In terms of feedback, the only thing that i somewhat missed is an option to put form variables in the mail's subject line.
For
example i just used your generator to generate an e-mail form for
people to fill out if they are going to be at a certain student party. 

It would be nice if you could somehow have; #somevariable# #someothervariable# with student number #yetanothervariable# would like to be at the party!

Greetings,


Kevin


Answer
:

All the form field values can be used for email subject line and body of the email message, both for the email you receive and the auto-response email.

The format of the field name is field_N. The N starts from 0. For example, you have 3 fields in the form,  the field names in the form will be field_0, field_1, field_2. If you want to control every field value in the email message, you can use %field_N% format. The %field_N% will be replaced with its value when the form submitted.

See screen shot below for details :

image


See How to customize email message in the field level? for more.

]]>
How to add HTML tags to form field label? http://www.formmail-maker.com/forum/index.php?p=/discussion/1/how-to-add-html-tags-to-form-field-labels Sun, 06 Mar 2011 20:14:37 -0500 admin 1@/forum/index.php?p=/discussions From User:
How can I (as in the image, highlighted in yellow) place a url-hyperlink in the checkbox-text? The usecase is "accept terms & conditions", as the screen shot below:
image




Answer :
The email form generator allows html tags for form field labels. Html tags are not allowed in the options text for field checkbox, radio button, and drop down at the moment ( Mar 6, 2011 ). In your case, the "accept terms & conditions" has to be placed in the form label. You can place the html tags for the form field like this :

Please accept  <a href="term.html" style="background-color: yellow;">terms & conditios</a>

See screen shot for details. Hope it works for you.
image


image]]>