Dawn Reel.com


Home

PORTFOLIO

Tutorials

OTHER

 

Cool Online Forms


Simple Forms
(created with this lesson)

www.irishouse.org

www.afrusaids.org

www.dawnreel.com

www.safersaner.org
(yes, Blackkat actually made a sexy form!)

How to Create Forms with NMS FormMail and LunarPages

There are many reasons to put up forms on your website.

Many people will access your website from a library or community technology center where the email is disabled.  With a form they can still contact you.

The key to getting people to stay on your website and to return to your website is to make it “interactive” – give THEM a way to do something.  Most websites just present information to the visitor, people will feel much more a part of your website and a community will develop if you put up ways for them to communicate.  One of the easiest ways is with forms:  Email Sign Up Forms, Poll Forms, Contact Info Forms, Ask a Question Forms and more! 

People often need help figuring out how to interact, with a form with specific questions it makes it easy and fun.

So how does it work?  XHTML allows you to build a form with fields on your website.  Dreamweaver makes it even easier.  However, you need to use a “CGI script” – a little program to make the information in the form send itself to an email address of your choice.  You can create a new email address in your Control Panel in LunarPages, or just use the same email address you always use.  Let’s work through an example. 

Let’s create a form that let’s people submit a question. 

Open up Dreamweaver.

Create a new page.

Switch to Code View.  Type in the following code:
<form method="post" action="/cgi-bin/name-of-form.pl">

<input type="hidden" name="recipient" value="1" />
<input type="hidden" name="subject" value="Ask “The Prevention Crew" />
<--<input type="hidden" name="required" value="email" />-->
<input type="hidden" name="redirect" value=http://www.preventaids.org/thankyou.html />
       
<input name="email" type="text" size="35" maxlength="45" value="email here (optional)" />
<br />

<textarea name="question" cols="50" rows="8">Type Your Prevention Question Here (no questions are dumb, not asking them is!):</textarea>

<br />
<input type="submit" /> &nbsp; &nbsp; &nbsp; <input type="reset" />

</form>

Where it says name-of-form, put in the real name of your form.
Where it says “Ask the Prevention Crew” put in the real title of your form.
Where it says redirect value, put the real name of your website instead of “preventaids.org” and the real name of your form confirmation received page instead of “thankyou.html” (although lots of people like that title).

Click back to Design View.  People really need community and to ask questions and make comments.  Add a picture and/or make the text inviting for them.  Click FILE --> SAVE and you are done for the first half.  Take a little break to clear your head. ;-)

For the second half you need to program a little code.  This will look great on your resume!

Go to http://nms-cgi.sourceforge.net/scripts.shtml and download the file “NMS FormMail”, the first one that says “compat” (.trg for Mac users, .zip for PC people).  Save it to your desktop.

Uncompress the file however you normally do (Win XP users can trying double-clicking on the file and then click the “Expand” button on the left and then when it allows you to choose where, be sure to choose “Desktop” or it will be hard to find!) IF this is not working, try right-clicking on the file and see if there is something for uncompress or unstuff or similar.

Then when it is expanded you will see a folder with around 6 files.  The only one you need is FormMail.pl. Right click on the file named “FormMail.pl” and rename it to a unique name, like “preventionquestion.pl” or something.  Don’t name it something obvious like “form.pl” or “question.pl” or that makes it too easy for hackers to take your website over. 

Now right click on it and choose Open in Notepad (not WordPad, Notepad). 

Take your time and do these exactly like the example or it won’t work.  It’s a lot of stuff but fortunately you only need to make some changes to the top section starting with  USER CONFIGURATION SECTION and continuing about 30 lines beneath that.  You need to go to the four lines that begin with the following  characters and customize the end of the lines:

Beginning of line:           What you need to customize:

$mailprog =        '/usr/sbin/sendmail –oi –t';
@referers =     qw(yourdomain.com  localhost);
[ex. qw(preventionaids.org localhost);
@allow_mail_to =           qw(yourdomain.com  localhost);
@recipient_alias = ('1' => 'email-form-will-be-sent-to@yourdomain.org')
[ex. '1' => 'question@preventaids.org')

[note:  you have to send the email to an address of your domain, not AOL for example.  Be sure to go to the LunarPages Control Panel --> Email --> Add New  section if this email hasn’t already been created.  ]
A few lines down it says From: and " youremailaddress” – put your email address or “Prevent AIDS” or some relevant text, whatever you prefer.

Now go FILE --> SAVE and close the file. 

You need to upload this file into the cgi-bin folder inside your Root Folder/Directory of your website (the folder where all your other web stuff is).  I don’t think you can do this in Dreamweaver, but you can use any FTP program (just be sure to upload it as ASCI and not Binary).  I think it is easiest to upload it with LunarPages. Just go to www.lunarpages.com and click the log in button at the top and sign in and click Control Panel.  Then click C Panel button on the left-middle of the page.  Then click File Manager icon.  Then double-click on the folder before public_html to open it up.  Then scroll down to and double-click on the folder before cgi-bin to open it.  Click on the Files Upload button at the top of the screen and then “browse” on the next screen, select your script (_____.pl file) and “Upload.” 

Once it is uploaded you have to do one more thing.  Click the back button on your browser to get back to your cgi-bin folder.  "File Manager"
- Click on the  filename of the .pl script file you just uploaded
- In the upper right-hand corner of your screen, click on "Change Permissions".
The following should be checked marked (R = Read, W = Write, E = Execute):
Owner: R, W, E
Group: R, E
All Users: R, E

Make sure to checkmark the boxes and NOT just type in the numbers. Typing in the numbers will NOT make the changes.
- Click the "Change" button.
When you finish, make sure that you see the change to 755 has taken place.

Whew!  We are done!  Now let’s try out the form.  Let’s upload everything in Dreamweaver (both CGI script we just programmed and our web question form).  Go to your website and try it out.

If it worked, great!  You are a super careful typist to have gotten it to work on the first try.  If not, check it again super carefully.  Ask Dawn or your neighbor to help.  Practice makes perfect.  Once you make @ 2 or 3 forms you will feel pretty comfortable with this CGI script and be ready to make more cool things with new CGI scripts. 

Note: 11-1-06: Darn, spammers have learned how to "exploit" or use this script to send crazy large amounts of email to you with. Lunarpages is now recommending to NOT use NMS form mail and to use the TFMail script. Tutorial soon.

(Lesson on a very cool mailing list manager, DaDa Mail, CGI script coming soon!)