Loading ...
Sorry, an error occurred while loading the content.

Re: [NH] Digest Number 24

Expand Messages
  • Marco Bernardini
    *This message was transferred with a trial version of CommuniGate(tm) Pro* ... Hi Jody! Here is my 2 lire form lesson. - ACTION must link a script, usually in
    Message 1 of 1 , May 23, 2000
    • 0 Attachment
      *This message was transferred with a trial version of CommuniGate(tm) Pro*


      > Date: Mon, 22 May 2000 22:00:58 -0500
      > From: Jody <KJB1611@...>
      >Subject: <FORM>

      >CSE Validator says I need an ACTION attribute.

      Hi Jody!
      Here is my 2 lire form lesson.

      - ACTION must link a script, usually in /cgi-bin (and this MUST BE
      executable); you can also use ACTION="mailto:myaddr@...", but
      this rely too much on the interaction between browser and mailer: better to
      avoid, because people hate to fill a form just to see *nothing* in their
      mailer.

      - METHOD can be GET (you see all form parameters on the address line) or
      POST (you don't see nothing)
      METHOD specifies how information is sent to the server specified by ACTION.
      GET (the default) appends the input information to the URL, which on most
      receiving systems becomes the value of the environment variable
      QUERY_STRING. POST sends the input information in a data body, which is
      available on stdin with the data length set in the environment variable
      CONTENT_LENGTH. If the METHOD attribute has the value "POST," then the
      ENCTYPE attribute typically has the value
      "application/x-www-form-urlencoded." [from Netscape JavaScript manual]

      - TARGET can be used if you need to work into a frame or to open another
      window.

      with Netscape 4.7, if you don't specify action AND method is GET, page is
      reloaded using form parameters.

      Try this sample with Netscape to see how GET parameters are shown:

      <HTML>
      <BODY>
      This page is:<BR>
      <script language="JavaScript">
      document.write("location.href = " + location.href + "<BR>")
      document.write("location.protocol = " + location.protocol + "<BR>")
      document.write("location.pathname = " + location.pathname + "<BR>")
      document.write("location.search = " + location.search + "<BR>")
      </script>
      <hr>
      <form method="get">
      <input name="cell"><BR>
      <input type=submit>
      </form>
      </BODY>
      </HTML>

      To see everything is passed to a CGI you can use this small perl script:

      #!/usr/bin/perl
      print "Content-Type: text/html\n\n";
      foreach $key (sort(keys %ENV)) {
      print $key, '=', $ENV{$key}, "<br>\n";
      }

      Save it as /cgi-bin/test.pl, set the execute permission to "everybody" and
      use ACTION="/cgi-bin/test.pl" into your form.
      When you submit the form you see everything about the form, the page, the
      server. Useful to find errors!

      I suggest who need to play with forms and CGI to install Apache and Perl
      (even on Win boxes!): there is a lot to learn!

      Bye!

      Marco Bernardini
    Your message has been successfully submitted and would be delivered to recipients shortly.