How to add a form to your site using CGIEMAIL Skriv ut

  • 58

How to add a form to your website, a quick and easy way to setup a contact or feedback form.

Login to your control panel an go to CGI Center.

Look for CGI Email...
It says "CGI Email takes the input of an HTML form and converts it to an email format defined by the author of the form."

To install the script click 'CGI Email'

The script will be installed and you'll be taken to which contains more information about working with the script.

How to integrate the script with your website...

Here is a simple contact form...

<FORM METHOD="POST" ACTION="">               
<INPUT TYPE="hidden" NAME="success" VALUE="">                
<div align="center">                    
<table width="539" border="0" cellspacing="5">                     
<tr><td><div align="right">Your Email Address:</div></td>                         
<td><INPUT NAME="email"></td></tr><tr>
<td><div align="right">Name:</div></td>
<td><INPUT NAME="yourname"></td></tr>
<tr><td><div align="right">Company Name:</div></td>
<td><INPUT NAME="coname"></td></tr>
<tr><td><div align="right">Address / Location:</div></td>
<td><INPUT NAME="address" size="50"></td></tr>
<tr><td><div align="right">Phone Number:</div></td>
<td><INPUT NAME="phone"></td></tr>
<tr><td><div align="right">Subject: </div></td>
<td><INPUT NAME="submess" size="30"></td></tr>
<tr><td valign="top"><div align="right">Message:</div></td>
<td><textarea name="message" cols="50" rows="10"></textarea></td></tr>
<tr><td height="30">&nbsp;</td>
<td valign="top"><INPUT name="submit" TYPE="submit" value="Send Message"></td></tr>

Copy the above code to your page, make sure to change to the name of your website.

Then you need to create a file that formats the data and specifies where it should be sent, we have called the following file contact.txt in the above code (create it and upload it to your /public_html/ folder). You'll need to set the email address where you want the information sent to, you'll also notice that the input names match the fields in the form, you can easily change them if you need to, just follow the same format. The contents of contact.txt should be...

Subject: Message submitted on Website
Name               [yourname]
Company Name   [coname]
Address    [address]
Phone Number   [phone]
Subject of Message  [submess]
Message               [message]

You also need to create a sucess page for your visitor to be redirected to after submission of the form, in the example above we've called it thanks_for_your_message.htm you can change that to whatever you like, but you must create a success page or the form won't work.

Hjälpte svaret dig?