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
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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],
print "<br>";
print "Password ";

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

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

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

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

print $q->endform;

print $q->end_html;



Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Scripting Languages

From novice to tech pro — start learning today.