Hello,
I don't know if I am posting this question to the right forum, excuse me if I am :
I have the following
1/ html file
<html>
<body>
<form method="post" action="test.pl">
<input type="hidden" name="hiddenfield" value="abc">
<input type="submit" value="TEST">
</form>
</body>
</html>
2/ perl script
#!/usr/bin/perl
use CGI qw
standard);
print "Content-type:text/html\n\n";
my $FormData;
# Read the standard input (sent by the form):
read(STDIN, $FormData, $ENV{"CONTENT_LENGTH"});
# Get the name and value for each form input:
@pairs = split(/&/, $FormData);
# Then for each name/value pair....
foreach $pair (@pairs) {
# Separate the name and value:
($name, $value) = split(/=/, $pair);
# Convert + signs to spaces:
$value =~ tr/+/ /;
# Convert hex pairs (%HH) to ASCII characters:
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
# Store values in a hash called %FORM:
$FORM{$name} = $value;
}
print "The following text was entered in the e text field: $FORM{'textfield'}";
print "The hidden text is: $FORM{'hiddenfield'}";
My variable doesn't get passed to the perl script? Running the perl script is no problem, but no variable?
I think the error is of trying to run this on my local PC (but that's the goal of my script!)
Is there another way to start a local perl script with variables from a local htm file?
thx,
vbkal
I don't know if I am posting this question to the right forum, excuse me if I am :
I have the following
1/ html file
<html>
<body>
<form method="post" action="test.pl">
<input type="hidden" name="hiddenfield" value="abc">
<input type="submit" value="TEST">
</form>
</body>
</html>
2/ perl script
#!/usr/bin/perl
use CGI qw
print "Content-type:text/html\n\n";
my $FormData;
# Read the standard input (sent by the form):
read(STDIN, $FormData, $ENV{"CONTENT_LENGTH"});
# Get the name and value for each form input:
@pairs = split(/&/, $FormData);
# Then for each name/value pair....
foreach $pair (@pairs) {
# Separate the name and value:
($name, $value) = split(/=/, $pair);
# Convert + signs to spaces:
$value =~ tr/+/ /;
# Convert hex pairs (%HH) to ASCII characters:
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
# Store values in a hash called %FORM:
$FORM{$name} = $value;
}
print "The following text was entered in the e text field: $FORM{'textfield'}";
print "The hidden text is: $FORM{'hiddenfield'}";
My variable doesn't get passed to the perl script? Running the perl script is no problem, but no variable?
I think the error is of trying to run this on my local PC (but that's the goal of my script!)
Is there another way to start a local perl script with variables from a local htm file?
thx,
vbkal