CGI Script

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jain236
    New Member
    • Jul 2007
    • 36

    CGI Script

    Hi every body,

    i am just new to the CGI scripting.
    i am trying to run a basic CGI script . i am using APACHE as my web server .

    i have placed my basic script inven.cgi in the web server and when i am trying to access my script with http://mydomain/inven.cgi
    instead of getting the functionality of the script , i am seeing the whole script code on the web page.Do i need to do any setting to run the CGI script?

    here is the code which i used

    Code:
    use CGI qw/:standard/;
      print header,
            start_html('A Simple Example'),
            h1('A Simple Example'),
            start_form,
            "What's your name? ",textfield('name'),p,
            "What's the combination?", p,
            checkbox_group(-name=>'words',
                           -values=>['eenie','meenie','minie','moe'],
                           -defaults=>['eenie','minie']), p,
            "What's your favorite color? ",
            popup_menu(-name=>'color',
                       -values=>['red','green','blue','chartreuse']),p,
            submit,
            end_form,
            hr;
    
       if (param()) {
           my $name      = param('name');
           my $keywords  = join ', ',param('words');
           my $color     = param('color');
           print "Your name is",em(escapeHTML($name)),p,
                 "The keywords are: ",em(escapeHTML($keywords)),p,
                 "Your favorite color is ",em(escapeHTML($color)),
                 hr;
       }
    
       print end_html;
    Thanking you in advance
  • rajiv07
    New Member
    • Jun 2007
    • 141

    #2
    Your script should be inside the cgi-bin directory which is a special directory to run the perl script.

    Regards
    Rajiv

    Comment

    • eWish
      Recognized Expert Contributor
      • Jul 2007
      • 973

      #3
      Sounds like the server is not setup correctly. Check to make sure that you have enable it to run CGI scripts.

      --Kevin

      Comment

      • jain236
        New Member
        • Jul 2007
        • 36

        #4
        Originally posted by eWish
        Sounds like the server is not setup correctly. Check to make sure that you have enable it to run CGI scripts.

        --Kevin
        Exactly..kevin. . i have made the changes.. thannx for you help

        Comment

        Working...