next up previous contents index
Next: Graphics Up: What you see on Previous: Plain text   Contents   Index


Forms

A very convenient way to move user input to the server is using HTML-Forms. Here are some examples for elements they offer:

Radio-buttons
A
B
C
and

The tags used in the above form are explained in reference section of the Web Design group and the HTML Tag Reference at Netscape.

In the example that we will describe in the appendix we generate the following screen:

Welcome to the game

You will play a game against a single opponent. Both of you will enter a number between 0 and 100. Your payoff will be twice the minimal number minus the number that you have chosen. The same holds for your opponent.

Please enter a number between 0 and 100:

This can be generated with the following HTML:

<h1>Welcome to the game</h1>
You will play a game against a single opponent.
Both of you will enter a number between 0 and 100.
Your payoff will be twice the minimal number minus
the number that you have chosen. The same holds 
for your opponent.<p>

<FORM METHOD=POST>
Please enter a number between 0 and 100: 
<INPUT TYPE=TEXT NAME="Number">
<INPUT TYPE=SUBMIT VALUE="Continue">
</FORM>

Next we would like to store the data somewhere. cgihtml provides a helpful set of commands:

The following C fragment puts all the data into a variable that we call cgi_entries and prints the value of the Form-entry Number into the variable x.

llist entries;
int x;
read_cgi_input (&cgi_entries);
printf ("%s",cgi_val (cgi_entries,"Number"));


next up previous contents index
Next: Graphics Up: What you see on Previous: Plain text   Contents   Index
Oliver Kirchkamp