FormM@iler and PHP Notes, Tips and Tricks

Posted by admin

You can build your own form and formmailer.php will send it's contents in the email. In the zip download, a more elaborate sample called form2.php is provided. View form2.php, with radio buttons, checkboxes, dropdown box.

Also note that each form does not have to end in PHP, the form page itself can have any extension, but formmailer.php MUST retain it's php extension and the action of the form must point to it.

Note that any form field that could contain multiple selection, such as a multi-select dropdown menu, or checkboxes of the same name must end their name with brackets []. This is a requirement of PHP so the PHP interpreter knows to expect the possibility of several answers!

DO NOT use spaces in the field names of your form. A good option is to use an underscore ("_") instead.

The config hidden field may seem confusing, but it is done this way to prevent spambots from harvesting actual email addresses from hidden fields the way many scripts do.

It is possible to have a selectable recipient list by making your config field a select type form field like so:

<select name="config">
<option value="0">Sales</option>
<option value="1">Support</option>
<option value="2">Marketing</option>
</select>

which makes the config value variable upon the choice of the user.