PDA

View Full Version : Form Help with CGI


Soad
09-02-2006, 07:38 AM
I have made a contact form in Dreamweaver but the instruction just seem to be getting the bettter of me

Could anyone highlight where I add the fields ??

Here is a guide on how to setup formmail so you can use it on your hosting account.

Firstly, you need to be aware that you need 3 files for the process to work, these are:
1) Your HTML form page, this can have any number of fields and drop down boxes but it does need a few extra ones added so it works with the script.
2) The formmail.cgi/formmail.pl script that takes the data from your form, reformats it and sends it to you in an e-mail
3) An HTML page confirming to your web site visitor that the information has gone through.

Firstly, go to the site www.scriptarchive.com and download the formmail.cgi file. We recommend you read through and try to understand all the information within the help files.

Now edit the formmail file in a text editor (like notepad) and make sure that the top of the file is correct, the mail parts you need to change
are:

The top part should look like:

#!/usr/bin/perl
################################################## ######################
######
# FormMail Version 1.92
#
# Copyright 1995-2002 Matt Wright mattw@scriptarchive.com #
# Created 06/09/95 Last Modified 04/21/02
#
# Matt's Script Archive, Inc.: http://www.scriptarchive.com/
#
################################################## ######################
######


The first line of this is the most important, also make sure your version is 1.92 or later, earlier versions are insecure.

further down the file it should read:

# $mailprog defines the location of your sendmail program on your unix # # system. The flags -i and -t should be passed to sendmail in order to # # have it ignore single dots on a line and to read message for
recipients #

$mailprog = '/usr/sbin/sendmail -i -t';


then a bit further down is another important part you will definitely have to alter:

@referers = ('mydomain.name','www.mydomain.name'); wwwmysite.com

In this line, you should include all domain names that are going to use this script, usually this is just your website with us. Make sure you put your actual hosted domain name in here.

@recipients = &fill_recipients(@referers,'services@123-reg.co.uk'); ??? what goes here

In this line ensure you put your e-mail address you are sending the files to instead of services@123-reg.co.uk. is it contact@mysite.com ??


This file can now be saved and uploaded to your website, make sure you upload the file in ASCII/text mode and NOT in binary mode. Also ensure it has read and execute permissions (755) for user group and all, as well as write permissions for the user.
You can set permissions for files via either your FTP client or more easily though the online file manager on your 123-reg control panel.
This is done by simply locating the formmail file, then clicking on its name (not the icon above the name) and ticking the apropriate boxes.

Now move onto your HTML file where your visitors fill in the form, make sure the code below is included.

<form action="/formmail/formmail.cgi" method="post">
Make sure this is the correct path to your formmail script.

<input type='hidden' name="recipient" value="services@123-reg.co.uk"/>
Make sure this is the e-mail address you are sending the details to. ?? whats this one ??

<input type='hidden' name="subject" value="Form Results"/>
Replace the value with the one you want the subject of the e-mail results to be.

<input type='hidden' name="required" value=""/>
Add any field names that the visitor has to fill in for the form to work.

<input type='hidden' name="redirect" value="done.html">
Put the location of the thank you HTML page here.

Most of it seems confusing to me any help please would be most gratefull

Thanks