Hi,
I need to print the query from the form using a simple script back as a link.
Here is what I have so far.
#!/usr/bin/perl
# Parse User Input
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
@pairs = split(/&/, $buffer);
foreach $pair (@pairs) {
local($name, $value) = split(/=/, $pair);
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$value =~ s/<!--(.|\n)*-->//g;
$FORM{$name} = $value;
}
&Content;
sub Content {
$query = $FORM{'query'};
$query =~ tr/ /+/;
print <<'EOM';
Content-Type: text/html
<html>
<head>
<A target="_blank" href="http://www.site.com/cgi-bin/data.pl?$query">query</A>
</body>
</html>
EOM
}
Here is the input form:
<form action="/cgi-bin/links.pl" method="POST">
<table width="300" border="0" cellspacing="0" cellpadding="3">
<caption align="top"><h2>Quick Links</h2></caption>
<tr>
<td>
<input type="text" name="query"><input
type="submit" value=" Go! "></center>
I do not know how to pass the "query" from the form to this link above.
I am able print it back as a simple print " " statement.
But I would like to avoid using a number of print statements as I can cut and paste my links within the EOM.
Can you help?
Thanks in advance
[This message has been edited by socrates (edited May 31, 1999).]
[This message has been edited by socrates (edited May 31, 1999).]
I need to print the query from the form using a simple script back as a link.
Here is what I have so far.
#!/usr/bin/perl
# Parse User Input
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
@pairs = split(/&/, $buffer);
foreach $pair (@pairs) {
local($name, $value) = split(/=/, $pair);
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$value =~ s/<!--(.|\n)*-->//g;
$FORM{$name} = $value;
}
&Content;
sub Content {
$query = $FORM{'query'};
$query =~ tr/ /+/;
print <<'EOM';
Content-Type: text/html
<html>
<head>
<A target="_blank" href="http://www.site.com/cgi-bin/data.pl?$query">query</A>
</body>
</html>
EOM
}
Here is the input form:
<form action="/cgi-bin/links.pl" method="POST">
<table width="300" border="0" cellspacing="0" cellpadding="3">
<caption align="top"><h2>Quick Links</h2></caption>
<tr>
<td>
<input type="text" name="query"><input
type="submit" value=" Go! "></center>
I do not know how to pass the "query" from the form to this link above.
I am able print it back as a simple print " " statement.
But I would like to avoid using a number of print statements as I can cut and paste my links within the EOM.
Can you help?
Thanks in advance
[This message has been edited by socrates (edited May 31, 1999).]
[This message has been edited by socrates (edited May 31, 1999).]