I patched this example together as a very simple program that is supposed to take the output from a form and produce another form with the parsed apart form entries. But it only returns a blank form. Am I missing something?
NOTE: I am using a GTE sponsered web site and they told me I needed the first 3 lines exactly as shown. At least when I did this the "internal server" error went away and I at least saw a blank form returned.
I am an experienced C++ and VB programmer, but Perl is brand new to me. And comments are welcomed.
#!/usr/local/bin/perl
use CGI qw(:cgi-lib :standard);
print header();
# Geturl.pl
#
# A little Perl script to read, decode and print the names
# and values passed to it from an HTML Form thru CGI.
# Get the HTML header, ender, define the page title.
require "/cgi-local"; # full path ? to what ?
# print "Content-type: text/html\n\n"; # another GTE addin
$Title = "Get Information From a URL";
# Get the query string
# $QueryString = $ENV{'QUERY_STRING'};
# Use split to make an array of name-value pairs broken at
# the ampersand char.
@NameValuePairs = split (/&/, $QueryString);
# Put up an HTML header, page title, and a rule.
&HTML_Header ($Title);
print "<BODY>\n";
print "<H1>$Title</H1>\n";
print "<HR>\n";
# Split each of the name-value pairs and print them on the page.
foreach $NameValue (@NameValuePairs)
{
($Name, $Value) = split (/=/, $NameValue);
print "Name = $Name, Value = $Value<BR>\n";
}
&HTML_Ender;
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.