|
|||
| week 13a - forms | |||
forms : |
getting information from the user
|
|
| introduction : |
Forms are a way to transmit information from the web page to the server. For example, if you want to collect the name and email address from people at your web site, you would use a form to do this. The form uses different input types (e.g. check boxes and pull down menus), to collect the information. When the user "submits" the form, that information is transferred to the server, where it is processed by a "CGI" program. This program may put the form data into a database, mail it to the site webmaster, or otherwise deal with the information. Form elements are inserted into the web page via the Forms sub-palette of the Insert palette. You must first insert the Form itself using the icon in the left hand corner of the Forms palette. You will see a dashed red line that indicates the boundary of the form. Each form element (text entry field, buttons, etc.) must be inserted within the red form outline.
Each form element has a name and a value.
Some form elements also have a displayed name, for example the items in a list. For example, if you have a list of states, the user sees names like California and Colorado. But the value of those items in the list will be set to CA and CO respectively.
|
|
| form elements : |
different ways for entering data Refer to pages 168-171 of Elements of Web Design for more details about each form element
|
|
| CGI program : |
handling the contents of the form As described above, a form transfers its information to a CGI program running on the server. The form has to specify the name and location of CGI program it will use. To do this, you need to put a special instruction in the form that points to the CGI program. In the Form Property Inspector, set the method to POST, and set the Action to: http://mdpx.artcenter.edu/cgi-bin/pvaform.pl The pvaform.pl CGI is a program on the MDP experimental server that will receive your form, and then create a new HTML page that displays the contents of your form. This CGI program, while not useful for any real application, allows you to see if your form is correct: if you named your fields properly, and if the values are correct.
|
|
| making a form : |
in Dreamweaver
|
|
| CGI software : |
sources and info To properly use forms on your website, you must use a CGI program on the web server. Your ISP may provide standard CGI programs or you may have a member of your development team who can set up a CGI program. As an alternative, there are many free forms handling CGI programs available for free on the Internet. Here are some links: Matt's Script Archive for lots of free scripts. Check out FormMail.pl in particular. http://www.worldwidemart.com/scripts/ Another of Matt Wright's sites: WebMonkey article on using free CGI scripts.
|
|
| FormMail.pl : |
software to process a form and send the results to the webmaster as email FormMail.pl is a very popular free CGI program for processing forms, as noted above. It receives the contents of the form, formats it, and then sends it to a specified email address. The program relies on hidden fields to specify where the contents of the form are emailed, as well as other configurations including the subject of the email, the return email address, etc. Here is a form set up for using FormMail.pl with many of the normally hidden fields "exposed" so you can see how it works (note: due to security restrictions, no email will be sent and this example actually uses pvaform.pl to show what how you set up the form). If this were set up to work for real, the Action of the form would typically be set to (the case of the letters is important!): /cgi-bin/FormMail.pl |
|
| Free
forms handling services |
A few companies offer free forms handling. You simply configure your form in the right way, and use a form handling CGI program on their server (rather than the server where your page resides). This is beneficial when your server doesn't have CGI capability. A good example of this service is: Response-O-Matic who can be found at: http://www.response-o-matic.com/ The only downside to this free service is that after the user submits their form, they see an advertisement. This service (like most automatic form CGI programs such as FormMail.pl) use hidden fields to specify how the form will work. In fact, Response-O-Matic.com uses FormMail.pl with minor modifications. The Action of the form should be set to: http://www.response-o-matic.com/cgi-bin/rom.pl Fill in this form, and you will see how it works. |
|
| Exercise |
Create a page that has a form similar to the forms_example.html example:
Optionally, make your form assignment with hidden fields and set the POST URL to make it work with response-o-matic. Due at end of class or week 14 |
| all materials on this web site © copyright 2003, Philip van Allen |
top |