Well since I first got here, my first idea for a script that I've never seen done was a program that took the parameters from a user and spit the out in alphabetical order. Now, I know this probably puts me back down to acolyte for my lack of knowledge here but I can't get this to work. When I run it on AP it runs perfectly, but when I run it on the web I type in the parameters, press "Submit" and get a 500 error which states : "
Improper header text1". I don't get that error message! Oh well, heres the script so you can all tell me what I'm so stupid for :-). NOTE: This is just to be basic, nothing great is supposed to go on here.
#!/usr/bin/perl -w
use CGI qw(param);
use diagnostics;
use strict;
my $query = new CGI;
if ($query->param()) {
foreach $key (sort {$a cmp $b} $query->param) {
print "<STRONG>$key</STRONG> = ";
my @values = $query->param($key);
print join(", ",@values),"<BR>\n";
}
}else{
print "Content-type:text/html\n\n";
print qq~
<HTml><head><title>Alphabetical Sorter</title></head>
<body><h2 align="center">Alphabetical Sorter.</h2>
<form method="post">
<input type="text" name="1"><Br>
<input type="text" name="2"><Br>
<input type="text" name="3"><Br>
<input type="text" name="4"><Br>
<input type="text" name="5"><Br>
<input type="submit" value="submit form">
</form>
~;
}
Help, please?
Update: I got this working thanks to
chipmunk:-) +++++++++++ Thanks all
Wanna be perl hacker.
Dave AKA damian
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.