1
(* $Id: counter.ml 1004 2006-09-25 16:01:06Z gerd $
2
* ----------------------------------------------------------------------
6
(***********************************************************************
7
* This example demonstrates a very simple CGI page that contains
8
* a counter that is incremented by the submit button.
10
* See add.ml for a slightly more complex example with more detailed
12
***********************************************************************)
14
let cgi = new Netcgi.std_activation ()
15
let out = cgi # output # output_string
16
let n = cgi # argument_value ~default:"0" "Count"
20
out "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\"";
21
out " \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n";
24
out "<TITLE>Counter</TITLE>\n";
27
out "<H1>Counter</H1>\n";
28
out "<FORM ACTION=\"counter.cgi\" METHOD=\"GET\"";
29
out " ENCTYPE=\"application/x-www-form-urlencoded\">\n";
30
out "<INPUT TYPE=\"SUBMIT\" NAME=\"Count\" VALUE=\"";
31
out (string_of_int (int_of_string n + 1));
37
(* ======================================================================
41
* Revision 1.1 2001/10/19 05:32:42 pdoane
42
* Moved to new example location