PDA

View Full Version : -Pretty Basic From Form To Perl Question



zazoo
September 27th, 2001, 18:20
ok, say I had a form like so....

<form action="http://www.serve4free.com/cgi-bin/test/write.pl" method="POST">
<input type="text" name="name" size="12" maxlength="20">
<input type="submit" name="submit" value="Log In">
</form>

what code should I put in the perl file just to make it print out the information in the text box in the next page thats loaded?

its a pretty stinkin easy question for you guys who know it but I just started learning yesterday :o

thanks in advanced ;)

Dusty
September 27th, 2001, 19:09
#!/usr/bin/perl

read(STDIN,$buffer,$ENV{'CONTENT_LENGTH'});
@pairs=split(/&/,$buffer);
foreach $pair(@pairs){
$pair=~s/%(..)/pack("c",hex($1))/ge;
$pair=~/(.+?)=(.*)/;
$form{$1}=$2;
}

print "Content-type: text/html\n\n";
print "<html><body>";
print "<textarea cols=10 rows=5>".$form{'name'}."</textarea>";
print "</body></html>";Dozens of other ways too.

zazoo
September 27th, 2001, 20:12
Thank you! :D