#! /usr/local/bin/perl

do '/com/web/docs/xperimental/cgi-hacks.pl';

print STDERR "Hello.\n";

# We got args.  Say what they were...

if (&find_form_args ('', 'fields')) {
    
  print <<EOF;
Content-type: text/html
Bogus-header: testing, testing, testing

<title>Response</title>
<h1>Response</h1>    
You submitted: <pre>
||$glb_qry||
EOF

  while (($var, $val) = each %fields)
  {
    print &HTMLize("$var = $val\n");
  }

  print "</pre>\n";
  print "<h2>Another form</h2>\n";

}
else
{
  print <<EOF;
Content-type: text/html
Bogus-header: testing, testing, testing
Another-bogus-header: la la la

<title>Simple form</title>
<h2>Simple form</h2>
EOF
}

print <<EOF; 
This is a demo form.  It's imbedded in the script (which would make
more sense if it were dynamically generated).  You can: <p>

<form method=POST>
Type some text:  <input name=small-text size=40> <br>
Type a lot of text: <textarea name=big-text rows=8 cols=40></textarea> <br>
Check the checkbox (or not): <input type=checkbox name=the-checkbox> <br>
and so forth... <p>
Finally, push <input type=submit value=this> button to submit the form.
</form> <p>

By the way, the environment was:
<pre>
EOF

while (($key, $val) = each(%ENV)) { print "$key=$val\n"; }

print "</pre>\n";
