Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
And the write.cgi file is like so.<form method="post" action="http://test/cgi-bin/write.cgi"> First Number: <input type="text" size="10" maxlength="4" name="no1"> Second Number: <input type="text" size="10" maxlength="1" name="no2"> Third Number: <input type="text" size="10" maxlength="1" name="no3"> Forth Number: <input type="text" size="10" maxlength="8" name="no4"> <INPUT type="SUBMIT" value="Submit">
My question is how can I output each number passed to the write.cgi rather than having the array $FORM print it?#!/usr/bin/perl print "Content-type:text/html\n\n"; read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); @pairs = split(/&/, $buffer); foreach $pair (@pairs) { ($name, $value) = split(/=/, $pair); $value =~ tr/+/ /; $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; $FORM{$name} = $value; } print "<html><head><title>Form Output</title></head><body>"; print "<h2>Results from FORM post</h2>\n"; foreach $key (keys(%FORM)) { print " $FORM{$key}<br>"; print"$key<br>"; } print "</body></html>";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: cgi input box process script
by Errto (Vicar) on Sep 22, 2004 at 01:53 UTC | |
|
Re: cgi input box process script
by bradcathey (Prior) on Sep 22, 2004 at 02:04 UTC | |
|
Re: cgi input box process script
by TheEnigma (Pilgrim) on Sep 22, 2004 at 01:50 UTC | |
|
Re: cgi input box process script
by TedPride (Priest) on Sep 22, 2004 at 07:52 UTC |