Contact Form Processing Products - for all your needs

FormMail • Form Encryption • Hosted Forms


This page documents the NEXT_NUM_FILE configuration setting in FormMail.

Type Of Setting

NEXT_NUM_FILE is an OPTIONAL setting, which means...

OPTIONAL : you can change this setting if you need to, but the default value is fine for most circumstances.


Enables use of the %nextnum% feature in "derive_fields".


Set NEXT_NUM_FILE to a file on your server that FormMail can use to generate unique numbers. This supports the %nextnum% feature in derived fields and allows you to use unique numbers for various purposes in your forms.

In general, FormMail generates sequential numbers using this file. The sequence may skip numbers in the case of errors and some other situations, so you shouldn't rely on the generated numbers not having gaps.

The file contains a single text line. You can change the number manually, but, be careful!

In general, for security reasons, the file should not be acessible from the web. So, try to place it above your Document Root or protect it with a .htaccess file or similar web server security mechanism.

Setting NEXT_NUM_FILE to an empty string disables the %nextnum% feature.

NOTE: you'll need to create the file on your server and make it writable by the web server software. For security reasons, FormMail cannot do this for you. In general, the correct permissions for your file are:


Create it as an empty file. An empty file is zero length, it does not have a blank line.

NOTE: on Windows servers, use '/' instead of '\' or double the '\' like this:




NOTE: the NEXT_NUM_FILE feature requires the use of PHP's "flock" function for locking the next number file. Some systems, especially some Windows versions (such as Windows 98, and the FAT file system) do not support file locking. FormMail will generate an alert message on these systems indicating that the feature is not supported.

Default Value



$NEXT_NUM_FILE = "/home/mysite/nextnum.txt";