Online Learning Applications for Technical English


Home
Syllabus
Assignments

Instructor



Producing Homepages

Reading User Input (for Example 3)

To send information from the browser to a CGI program, we need to construct a form as follows:

<HTML>
<HEAD>
  <TITLE>Sample form for Example 3</TITLE>
</HEAD>

<BODY>

<FORM>
</FORM>

</BODY>
</HTML>

In the form area, we specify the necessary fields. For example:

<HTML>
<HEAD>
  <TITLE>Sample form for Example 3</TITLE>
</HEAD>

<BODY>

<FORM>
  Name:  <INPUT TYPE="TEXT" NAME="NAME"> <BR>
  Student ID #:  <INPUT TYPE="TEXT" NAME="STUDENT_ID_NUM"> <BR>

<P>

  <INPUT TYPE="SUBMIT" VALUE="OK">
</FORM>

</BODY>
</HTML>

There are two methods for sending information from a browser form to a CGI program:

  • GET - pass information through QUERY_STRING environment variable
  • POST - pass information through STDIN

We specify the method and the program which will process the input fields in the <FORM> tag fields:

<HTML>
<HEAD>
  <TITLE>Sample form for Example 3</TITLE>
</HEAD>

<BODY>

<FORM METHOD="GET" ACTION="/cgi-bin/cai_pnk/disp_log.cgi">
  Name:  <INPUT TYPE="TEXT" NAME="NAME"> <BR>
  Student ID #:  <INPUT TYPE="TEXT" NAME="STUDENT_ID_NUM"> <BR>

<P>

  <INPUT TYPE="SUBMIT" VALUE="OK">
</FORM>

</BODY>
</HTML>

[ Back ]