STFM 96 Web Workshop II Home | Society of Teachers of Family Medicine | Faughnan Home | Elson Home | STFM 96 Introductory Web Workshop
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.
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 |
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.
This is what part of the form looks like to the user.
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>
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;
Here's just one calculation tield in FileMaker, shown as it appears in the browser and in source code format.
<HTML>
<HEAD><TITLE>
1996 AMIA Spring Congress
</TITLE></HEAD>
<BODY>
<h2>Supplemental Author/Abstract Information</h2>
"<P>" & lname & ", " & fname &
If(Right(fname, 1) = "." , " ", ". ") &
If(coauth != "","<BR>" & coauth, "") &
"<BR>" & title & "<BR>" &
"AMIA Spring Conference, 1996" & "." & "<BR>"
& inst &
If(Length(email) > 0,
"<BR>" & "<A HREF = ""mailto:" & email
& """>email: " & email & "</A>",
"") &
If(Length(url) > 0,
"<BR>" & "<A HREF= """ & url &
""">URL: " & url & "</A>", "")