session -12 FORMS
In order to send this information, you will need a submit button. This button performs the ACTION you entered in the very beginning of your form. Also, a reset button to clear everything. After inserting this last line, be sure to end everything with </form> (after the last buttons).<INPUT TYPE="submit"><INPUT TYPE="reset">
Here are a few tips to help you avoid some of the common problems encountered when learning to use cgiemail.Specifying the action parameter correctly:
The action parameter of the form tag, action="/cgi-bin/cgiemail/~YOUR_USERNAME/mailform.txt", is actually specifying two things. First it identifies the program to run, "/cgi-bin/cgiemail". Second, it gives the path to the template file, ~YOUR_USERNAME/mailform.txt. Always specify the program exactly . "/cgi-bin/cgiemail". The path to the text file is the web URL to get to the text file, starting with how to get to your home directory, often ~username. Note that the two paths are combined with a slash "/".
Specify the mail header information in the template file. Mail headers are lines that specify the subject of the message, who it is from and who it is to. When sending your mail message, lines are interpreted as mail header lines until the first blank line. So your template is of the form: Do NOT put a blank line at the top of the template file; you'll have no mail headers and your message will go nowhere.
[mail headers]To: username@mindspring.com
From: user@domain.com
Subject: My cgiemail Test Page[body of message]This message was mailed from [fname] [lname]
of [city], [state]. Should you wish to
reply, use either:
[fname] [lname]
[address]
[city], [state] [zip]or[from-email]If you're building an HTML form for your Web site, be careful where your place any FONT tags. Otherwise your form may look different under Netscape Navigator and Microsoft Internet Explorer. As your Web site grows, sooner or later you'll want to add an HTML form to it. For example, a weekly or monthly newsletter is one of the keys to building your site's traffic. To let visitors subscribe to your newsletter, you might build a form like this into your site:
<FORM METHOD="GET" ACTION="/cgi-bin/subscribe.cgi"> <FONT FACE="arial" SIZE="2"> Enter Your Email Address: <BR> <INPUT TYPE="text" NAME="email" SIZE="20"> <BR> <INPUT TYPE="submit"> </FONT> </FORM>This HTML code will create the form shown below. The form consists of a simple text field, with a label next to it reading "Enter Your Email Address," and a submit button.
Notice, that we've embedded a FONT tag inside the form. This lets us set the type face for the "Enter Your Email Address" label. We've also set the SIZE attribute for our font to equal "2." That's fine, but if you do this, be careful where you put the closing FONT tag. Otherwise the form may look different under Netscape and Microsoft browsers.
Figure 1 below shows our form as viewed with Microsoft Internet Explorer Version 5. Figure 2 shows the same form as viewed with Netscape Navigator Version 4.7 The reason for this is that Netscape and Microsoft apply the FONT tag differently. Netscape allows the INPUT tag to be affected by the FONT tag; Microsoft doesn't.
The magnitude of this difference depends on exactly how you set your FONT tag. In this example, when we view the page on a PC, Microsoft sets the text field to be roughly 150 pixels wide; Netscape set it about 180 pixels, a 20% difference. If our FONT tag is set with SIZE = 3, Netscape will make the text field more than 250 pixels wide, a 60% difference!
That difference can often wreck your page layout. If you place your form inside a table with a carefully determined width, having a form element grow by 60% may cause parts of page layout be pushed to one side.
The solution to this is to be careful where your close your FONT tag. In our example, closing the FONT tag just before the INPUT tag solves the problem.
<FORM METHOD="GET" ACTION="/cgi-bin/subscribe.cgi"> <FONT FACE="arial" SIZE="2"> Enter Your Email Address: <BR> </FONT> <INPUT TYPE="text" NAME="email" SIZE="20"> <BR> <INPUT TYPE="submit"> </FORM>Now Netscape and Microsoft browsers set the text field to roughly the same width.
Music News Health History Sports Archaeology Geography College Courses