CGI Script - Not getting form value

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • tovenkatesh82
    New Member
    • Mar 2007
    • 30

    CGI Script - Not getting form value

    Code:
    <html>
    <head>
    <title></title>
    <body>
    <form name=name form method=post action=C:/inetpub/wwwroot/b.cgi>
    enter your name:<input name=name type=text><br>
    <input type=submit>
    </form>
    </body>
    </html>
    below is the b.cgi file
    Code:
    #!/perl/bin/perl5.6.1.exe
    use strict;
    use CGI qw(:standard);
    my $name=param("name");
    print "Content-Type:text/html\n\n";
    print $name;
    I am using IIS server......"$n ame" is not getting printed.
  • KevinADC
    Recognized Expert Specialist
    • Jan 2007
    • 4092

    #2
    Add a sanity check to make sure the CGI script is at least working:

    Code:
    #!/perl/bin/perl5.6.1.exe
    use strict;
    use CGI qw(:standard);
    my $name=param("name");
    print "Content-Type:text/html\n\n";
    print "Sanity check - it works\n"
    print $name;
    .

    Comment

    • tovenkatesh82
      New Member
      • Mar 2007
      • 30

      #3
      yes the cgi script is working fine.....i have done a sanity check.


      Originally posted by KevinADC
      Add a sanity check to make sure the CGI script is at least working:

      Code:
      #!/perl/bin/perl5.6.1.exe
      use strict;
      use CGI qw(:standard);
      my $name=param("name");
      print "Content-Type:text/html\n\n";
      print "Sanity check - it works\n"
      print $name;
      .

      Comment

      • KevinADC
        Recognized Expert Specialist
        • Jan 2007
        • 4092

        #4
        maybe its the form tag:

        Code:
        <[b]form[/b] name=name [b]form[/b] method=post action=C:/inetpub/wwwroot/b.cgi>
        remove the second "form" and retry.

        the path also looks wrong:

        C:/inetpub/wwwroot/b.cgi

        that should be a URL not a machine path.

        http://localhost/cgi-bin/b.cgi

        or something like that.

        Comment

        • tovenkatesh82
          New Member
          • Mar 2007
          • 30

          #5
          tried out whatever you suggested but it does not works.......can you tell me why
          not to use the machine path?......sinc e i am working on iis server i saved the
          .cgi file in wwwroot dir.......the path i mentioned in the html file is http://localhost/b.cgi

          Originally posted by KevinADC
          maybe its the form tag:

          Code:
          <[b]form[/b] name=name [b]form[/b] method=post action=C:/inetpub/wwwroot/b.cgi>
          remove the second "form" and retry.

          the path also looks wrong:

          C:/inetpub/wwwroot/b.cgi

          that should be a URL not a machine path.

          http://localhost/cgi-bin/b.cgi

          or something like that.

          Comment

          • KevinADC
            Recognized Expert Specialist
            • Jan 2007
            • 4092

            #6
            The machine path is the direct path to the cgi/perl script. Thats not how you normally invoke cgi scripts from a browser, not even a local script on a local server. You send the request to the server (via a URL) which processes the request and sends a response back to the browser. Maybe iis works differently but I don't think so.

            Comment

            • tovenkatesh82
              New Member
              • Mar 2007
              • 30

              #7
              hi kevin....do i need to install or add some module to my code before using
              the param function as the perl compiler is not recognizing the param function....
              i looked into CPAN but i did not got anything concrete....do u have any idea
              regarding this??

              Originally posted by KevinADC
              The machine path is the direct path to the cgi/perl script. Thats not how you normally invoke cgi scripts from a browser, not even a local script on a local server. You send the request to the server (via a URL) which processes the request and sends a response back to the browser. Maybe iis works differently but I don't think so.

              Comment

              • KevinADC
                Recognized Expert Specialist
                • Jan 2007
                • 4092

                #8
                You might need to install the CGI.pm module. The version of perl your script appears to be using is very old:

                perl5.6.1.exe

                I would suggest installing the newest version of perl which I think is 5.8.8 (don't install perl 6).

                Comment

                Working...