Fundamentals of Computer Science 1 (CS151 2003S)

Laboratory: More CGI

Summary: In this lab, we continue our investigations of CGI scripting.

This lab is optional. It is intended for students who complete the first CGI lab early.

Useful Files:

Exercises

Exercise 0: Preparation

a. Make copies of the following files:

b. Start DrScheme.

Exercise 1: Generating Forms

While we've been creating our HTML forms in a text editor, it is also possible to generate a form with a CGI script.

a. Look at newgreeting.ss and see if you can figure out what it does.

b. Load newgreeting.ss from within DrScheme and execute both greeting-form and greeting-page to see that you understand what strings they generate.

c. Create a corresponding CGI file newgreeting.cgi, but don't create a corresponding HTML file. Load the CGI file in your browser and see what happens.

d. Can you tell why we didn't have to create an HTML page for newgreeting?

Exercise 2: Working with Numbers

Write a CGI script that takes a number as input and produces the square root of that number as output. Since CGI variables are passed as strings, you will probably want to use the string->number and number->string procedurese to convert to and from numbers.

Exercise 3: Working with Style Sheets

a. Look at colorful.ss and see if you can determine what it does.

b. Create colorful.cgi, a CGI file that loads colorful.ss.

c. Load colorful.cgi through your Web browser and try entering different colors to see what happends.

d. What happens when you select the color yellow? Why? Fix the problem you've found in this step.

e. Extend colorful.ss so that it supports more than those four colors.

f. Extend colorful.ss so that it takes both a background color and a foreground color.

 

History

Tuesday, 11 February 2003 [Samuel A. Rebelsky]

 

Disclaimer: I usually create these pages on the fly, which means that I rarely proofread them and they may contain bad grammar and incorrect details. It also means that I tend to update them regularly (see the history for more details). Feel free to contact me with any suggestions for changes.

This document was generated by Siteweaver on Tue May 6 09:28:59 2003.
The source to the document was last modified on Tue Feb 11 12:53:32 2003.
This document may be found at http://www.cs.grinnell.edu/~rebelsky/Courses/CS151/2003S/Labs/more-cgi.html.

You may wish to validate this document's HTML ; Valid CSS! ; Check with Bobby

Samuel A. Rebelsky, rebelsky@grinnell.edu