468,316 Members | 2,026 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,316 developers. It's quick & easy.

CGI Script

36
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

Expand|Select|Wrap|Line Numbers
  1. use CGI qw/:standard/;
  2.   print header,
  3.         start_html('A Simple Example'),
  4.         h1('A Simple Example'),
  5.         start_form,
  6.         "What's your name? ",textfield('name'),p,
  7.         "What's the combination?", p,
  8.         checkbox_group(-name=>'words',
  9.                        -values=>['eenie','meenie','minie','moe'],
  10.                        -defaults=>['eenie','minie']), p,
  11.         "What's your favorite color? ",
  12.         popup_menu(-name=>'color',
  13.                    -values=>['red','green','blue','chartreuse']),p,
  14.         submit,
  15.         end_form,
  16.         hr;
  17.  
  18.    if (param()) {
  19.        my $name      = param('name');
  20.        my $keywords  = join ', ',param('words');
  21.        my $color     = param('color');
  22.        print "Your name is",em(escapeHTML($name)),p,
  23.              "The keywords are: ",em(escapeHTML($keywords)),p,
  24.              "Your favorite color is ",em(escapeHTML($color)),
  25.              hr;
  26.    }
  27.  
  28.    print end_html;
  29.  
Thanking you in advance
Jul 3 '08 #1
3 1181
rajiv07
141 100+
Your script should be inside the cgi-bin directory which is a special directory to run the perl script.

Regards
Rajiv
Jul 3 '08 #2
eWish
971 Expert 512MB
Sounds like the server is not setup correctly. Check to make sure that you have enable it to run CGI scripts.

--Kevin
Jul 3 '08 #3
jain236
36
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
Jul 4 '08 #4

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

6 posts views Thread by Mike Daniel | last post: by
2 posts views Thread by bilaribilari | last post: by
reply views Thread by NPC403 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.