• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 164
  • Last Modified:

EASY!!!! making a script

How do i make a cgi script?

Do i need a certain program to compile it or what?

I know the code i want to use...but how do i make it into a script..

Please help
0
wormboy__6
Asked:
wormboy__6
1 Solution
 
MindoCommented:
A CGI script is a file with an extension *.cgi, for instance myscript.cgi. As a rule, it's written in Perl.

Here's a sample CGI script (It demonstrates the use of almost any form element):
======================================
#!/usr/local/bin/perl -w

use CGI qw(:standard);

$q = new CGI;

print $q->header,
      $q->start_html("Form Demo"),
      $q->h1("Form Demo");

$length = 20;
$max = 20;
$value = "Mindaugas";
$method = "POST";
$action = "http://www.soften.ktu.lt/~genumind/perl/formresults.cgi";

print $q->startform($method, $action, "");
print "Name ";
print $q->textfield('name', $value, $length, $max);

print "<br>";
print "Hobbies ";
print $q->checkbox_group(-name=>'hobbies',
                         -values=>['eating','sleeping', 'programming','music'],
                         -defaults=>['eating', 'programming']);
print "<br>";
print "Operating System ";

print $q->radio_group(-name=>'OS',
                      -values=>[Unix, Windows, Macintosh],
                      -default=>'Unix');
print "<br>";
print "Password ";

print $q->password_field(-name=>'secret',
                         -value=>'starting value',
                         -size=>20,
                         -maxlength=>80
);
print "<br>";
print "Popup menu ";

print $q->popup_menu(-name=>'menu_name',
                     -values=>['One', 'Two', 'Three'],
                     -default=>'One');
print "<br>";
print "Scrolling list ";

print $q->scrolling_list(-name=>'list_name',
                         -values=>['One', 'Two', 'Three'],
                         -size=>3,
                         -multiple=>'true'
);
print "<br>";

print $q->submit;
print $q->reset;
print "<br>";

print $q->endform;

print $q->end_html;

======================================

0
 
ozoCommented:
You can make a CGI program any language.
You need an HTTP server to execute it as CGI.
Whether it knows to execute it based on a particular extension, or being in a particular directory depends on how you have configured the server.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now