Contact form

We have a form script (based on nms-Formmail) that you can use to collect information from a form and send it to an email address. An example of the use of such a form is on an order page.

To use this solution, follow these steps:

  1. Download our finished script template (two files; form.html & mail.php) here.
  2. Open the file “mail.php” in a text editor. Edit line 2 and enter the email address where you want messages sent via the form.
  3. Upload the file to the desired path on your website via FTP.
  4. Edit line 9 of the “form.html” file (http://mindoman.se/mail.php) with the correct path to the script you uploaded in step 3.
  5. Upload the file “form.html” to the desired location where you want to place the form.

Done! The form is now ready to be used on e.g. “http://mindoman.se/form.html”.

If your website has an SSL certificate and therefore uses https://, the links in the scripts must also be https://.

If your website with the form runs on our Autobahn platform, you instead need to create a subdomain located on the UNIX platform where you upload the script, and then link to “http://subdoman.mindoman.se/mail.php” instead.

Examples of how a form can look and functions that can be used

<!DOCTYPE html>
<html lang="no">
<head>
    <meta charset="UTF-8">
    <title>Form page</title>
</head>
<body>
<form name="form" method="post" 
    action="http://mydomain.com/mail.php" accept-charset="iso-8859-1">
    <p>
        Fill out this form and press Send.
        We will respond as soon as we can.
    </p>

    <input type="hidden" name="redirect" 
        value="http://www.mydomain.com/thankyou.html">
    
    <p>
        <label>
            Navn<br>
            <input type="text" size="25" name="name">
        </label>
    </p>

    <p>
        <label>
            Email<br>
            <input type="text" size="25" name="email">
        </label>
    </p>
    
    <p>
        <label>
            Case<br>
            <select name="subject" size="1">
                <option value="help">Help</option>
                <option value="tips">Tips</option>
                <option value="other">Other</option>
            </select>
        </label>
    </p>
    
    <p>
        <label>
            Fill out your question<br>
            <textarea name="body" cols="40" rows="15"></textarea>
        </label>
    </p>

    <p>
        <input type="submit" value="Send">
    </p>
</form>
</body>
</html>

Reference

Below is an explanation of what the different fields in Formmail mean.

subject

This field specifies the heading of the e-mail message. If this field is not included then the default heading is used: WWW Form Submission.

<input type="hidden" name="subject" value="Contactform">

email

This field allows users to enter their email address. If this field is filled in, this email address is set as the sender, so that you can reply to the message directly via email.

<input type="text" name="email">

realname

This field lets users fill in their name. If this field is filled in, the name is set as the sender of the message. The field can very well be combined with the email field to create the sender of the messages in the form “Name” .

<input type="text" name="realname">

redirect

This field defines which page the user should be redirected to after the form is completed and sent, e.g. a thank you page. It is recommended to hide this field.

<input type="hidden" name="redirect" value="http://www.mydomain.com/thankyou.html">

required

With this field you can require one or more fields to be filled in before the page can be sent. Just enter the names of the fields you want to be mandatory in the value for this field. If the users have not filled in the required fields, they will be notified via an error page. How to set the wrong page you want to read more about below.

<input type="hidden" name="required" value="email,name">

missing_fields_redirect

This field defines which error page you want if you have used the required field. This allows you to customize the error page yourself, instead of using the default error page.

<input type="hidden" name="missing_fields_redirect" value="http://www.mydomain.com/formerror.html">

Was this article helpful?

Related Articles