demo
templates
install
contact
Home Help Forms

Forms processor

Contentor has a utility called "formproc.php" that will send the contents of a form to an e-mail address and/or save the information to a database table. The form itself must be constructed in HTML, then cut and pasted into a page section. In version 0.955 and later, the form HTML can be stored in the "setup" table in the database and inserted on the page with the [form] tag.  If the user is logged at an administrator level, the formproc.php routine will automatically create data tables and fields (columns) in response to the submited form.

An example form, similar to the /contact form on this site, is shown below:
<form action="formproc.php" method="post" name="mailForm" id="mailForm">
  <table border="0" cellspacing="0" cellpadding="2">
    <tr>
      <td align="right" valign="top">Name</td>
      <td><input type="text" name="realname" /> </td>
    </tr>
    <tr>
      <td align="right" valign="top">E-mail:</td>
      <td> <input type="text" name="email" /> </td>
    </tr>
    <tr>
      <td align="right" valign="top">Comments:</td>
      <td> <textarea name="comments" cols="60" rows="5" wrap="virtual"></textarea>
      </td>
    </tr>
    <tr>
      <td align="right">
        <input type="hidden" name="to" value="yourAddress*yourDomain.org" />
        <input type="hidden" name="options" value="7" />
        <input type="hidden" name="subject" value="Feedback Form" />
        <input type="hidden" name="datatable" value="form_info" />
        <input type="hidden" name="response" value="Thank you for your submission" />
      </td>
      <td> <input type="submit" name="Submit" value="Submit" /> </td>
    </tr>
  </table>
</form>

Note that the form "action" is "formproc.php" and the form "method" is "post".

The person's name can be entered into a field called "realname" or in two separate fields called "firstname" and "lastname".
There should be a text input field called "email" for the return e-mail address of the person filling out the form.

Hidden fields are used to specify the e-mail recipient (to), the subject (optional, could also be a text input) and the processing "options".
To prevent e-mail harvesting robots from detecting the "to" address, you may use the "*" character in the place of the "@" symbol in the "to" e-mail address. See the note below about allowed "to" e-mail addresses.

The "options" field controls the action of the forms processor.
value: action:
1   - Send e-mail
2   - Save to data base (in table specified by the "datatable" entry)
4   - Display the submitted data on the response screen

Add the above values for the desired action. For all actions, enter "7" as the value for "options". To display the data and save it, but not e-mail, enter "6" for "options".

An optional "response" field allows your to control the action after the form data has been saved or sent via e-mail. If the "response" starts with a "/" character, it is interpreted as redirect to a page name, and the script will jump to that page. Otherwise, the script will display the sentence specified in "response". If "options" >= 4, the "response" value must not redirect to another page in order to display the submitted data.


NOTE: To prevent spammers from using the forms processor, the 'to' address must be allowed by the '_formproc_allowed' entry in the configuration setup file.