Frequently asked questions

Back
How do I make a feedback form?

Our standard form

If you want a feedback form on your website, e.g. to allow visitors to fill out a form that's e-mailed to you, you may use our standard CGI script for feedbacks.

We assume that you know a bit about coding in HTML.

Create a HTML form (<FORM>) with the following action parameter: action="https://www.domeneshop.no/cgi-bin/mailto.cgi" accept-charset="ISO-8859-1". Add hidden input fields with values for "_to", "_from", "_subject" and"_resulturl". Any input field without the underscore ("_") prefix will be sent as a part of the message itself.

Example:

<form method="POST" action="https://www.domeneshop.no/cgi-bin/mailto.cgi" accept-charset="ISO-8859-1">
<input type="hidden" name="_to" value="yourname@yourdomain.com">
<input type="hidden" name="_from" value="feedback@yourdomain.com">
<input type="hidden" name="_subject" value="Feedback">
<input type="hidden" name="_resulturl"
value="https://www.domainnameshop.com/eksempler/receipt.html">
...
<input type="text" name="Field1" value="Enter your question">
<input type="checkbox" name="Field2" value="Yes">
<input type="radio" name="Field3" value="1">
<input type="radio" name="Field3" value="2">
...
</form>

After creating your form, you must login to the web control panel and register the e-mail address you put in the "_to" field as a valid recipient address. (Select your domainname, select "Web hosting" from the menu at the top of the grey rectangle with domain information, and then "View/change" for "Feedback form".)


Creating your own form

If you have Webhotel Medium or larger, you may also create your own feedback forms with PHP or CGI scripts. This is advisable only for experienced users who know a bit of programming.

A PHP example follows below. We have assumed that the input fields from your home-made HTML form are "name" (the sender's name), "email" (the sender's e-mail address) and "message" (the message text). The script does not permit you to click on "reply" in your e-mail program to send a response directly to the claimed sender. It is important that the form does not permit anyone to enter information used for the sender or recipient addresses, and that both these addresses are under your control.

<?php
// Fetch the values from the form
$name = $_POST['name'];
$email = $_POST['email'];
$message = $_POST['message'];

// Check for invalid characters in e-mail and name.
// Accept certain European special characters.
// Prevent messages longer than 500 characters.
// This reduces the risk of spamming.

if(preg_match("#[-a-zA-Z0-9éèÉÈäöæøåÄÖÆØÅ._ ]+#",$name) AND
   preg_match("#[-a-zA-Z0-9.@+!=()_:]+#",$email) AND
   strlen($message) < 500) {

  if (mail("yourname@yourdomain.com", // your e-mail address
           "Feedback from your webpage", // subject
           "Message from $name <$email>:\n\n$message", // the message text
           "From: Feedback form <yourname@yourdomain.com>" // the sender
          )) {
?>

<p>The message has been sent.</p>

<?php
  } else {
?>

<p>Failed to send the message via e-mail,
please get in touch via phone or postal mail.</p>

<?php
} else {
?>

<p>Invalid request. The attempt has been logged.</p>
<p>
Names may only contain the characters <code>-a-z0-9éèäöæøå._</code>,
e-mail addresses only <code>-a-zA-Z0-9.@+!=()_:</code>,
and the message may not be longer than 500 characters.</p>

<?php
  # Probably abuse, add logging of the request here.
}
?>

Keyword:  

Index

© 2017 Domeneshop AS · About us · Terms & Conditions · About cookies