STFM 96 Web Workshop II Home | Society of Teachers of Family Medicine | Faughnan Home | Elson Home | STFM 96 Introductory Web Workshop


STFM '96 Web II: HTML Forms


Table of Contents

  • Introduction
  • Web Application: AMIA s96 Submissions
  • Sample Form (browser view)
  • Sample Form (source view)
  • Perl Script
  • FileMaker Pro Calculation Fields (output)

  • Introduction

    This longish page illustrates some of the components that went into a web application which accepted submissions for an annual academic meeting. The overall application used a web form, a Perl CGI, email, text processing, and HTML output from a database.

    It's more elegant and powerful to have the web browser interact with a database via CGI, rather than mailing results and then processing them. Nonetheless, the excerpts shown below give one the flavor or a typical web application.

    [Return to Table of Contents]

    Web Application: AMIA s96 Submissions

    This table illustrates the flow of data in a simple web application. The application was created to accept author submissions for the 1996 spring meeting of the American Medical Informatics Association (AMIA).

    client server CGI or application
    [1] form web server Perl script (CGI)
    mail box sendmail

    Table Notes


    CGI: common gateway interface
    [1] post is the most common method of sending data, often text is "url-encoded". Get is used for searches or queries and also uses "url-encoding". Less used are: head, put, delete, link, and unlink.

    [Return to Table of Contents]

    Sample Form (browser view)

    This is what part of the form looks like to the user.

    First and Middle Names/Initials

    Last Name

    Names of coauthors

    [Return to Table of Contents]

    Sample Form (source view)

    This is the source code that produced the form.

    <P> <FORM ACTION="/~john/cgi-bin/mail_amia.cgi" METHOD="POST">
    <P> <H4>First and Middle Names/Initials</H4>
    <INPUT TYPE="text" NAME="fname" SIZE=20>
    <P> <H4>Last Name</H4>
    <INPUT TYPE="text" NAME="lname" SIZE=30>
    <P> <H4>Names of coauthors</H4>
    <TEXTAREA NAME="coauth" ROWS=2 COLS=80></TEXTAREA>
    <P> <!-- Submit or Reset -->
    <INPUT TYPE="submit" VALUE="Submit Form"><INPUT TYPE="reset" VALUE="Reset Form">
    <P> </FORM>

    [Return to Table of Contents]

    Perl Script

    This is Perl code that accepted the form data (from the web server) and them mailed it out in a processed form. This Perl code loads a "library" of specialized HTML functions to facilitate processing.

    #!/usr/local/bin/perl -- -*-perl-*-
    # Based on HTML4dummies Comment remailer 6/5/95 - singe@outer.net
    require "formlib.pl";
    $| = 1;
    amp;GetFormArgs();
    $ENV{PATH_INFO} ne '' && &GetPathArgs($ENV{PATH_INFO});
    chop ($date = `/bin/date`);
    print "Content-Type: text/html\n\n";
    open (SUBMSSN,"| /usr/ucb/Mail -s \"Submission: $in{lname} \" john\@umnhcs.labmed.umn.edu" );
    print SUBMSSN "$date";
    print SUBMSSN "\n[!DL!]";
    print SUBMSSN "$in{fname}";
    print SUBMSSN "\n[!DL!]";
    print SUBMSSN "$in{lname}";
    print SUBMSSN "[!ER!]";
    close (SUBMSSN);
    print STDOUT "<H1>Thank you for your submission!</H1><P>",
    exit;

    [Return to Table of Contents]

    FileMaker Pro Calculation Fields (output)

    Here's just one calculation tield in FileMaker, shown as it appears in the browser and in source code format.


    Author: John G. Faughnan.  The views and opinions expressed in this page are strictly those of the page author. Pages are updated on an irregular schedule; suggestions/fixes are welcome but they may take weeks to months to be incorporated. I reserve copyright except where noted, if you want to repost or quote a page just ask. Anyone may freely link to anything on this site and print any page; no permission is needed for linking,  printing, or distributing printed copies.