Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Form Post Content Length

Status
Not open for further replies.

wsexton

Technical User
Dec 4, 2001
49
0
0
US
When I submit an HTML form I'm not getting a content length environment variable. Here's my HTML: <form name="feedback" method="post" action="cgi-bin/feedback.pl">

The feedback.pl is a perl script that looks at the environment variables. I'm not getting the content length. Any ideas?

Thanks.
 
What do you mean by "content length". You don't get it where? In the Perl script? Maybe just a little more info :)

Cheers,
Jeff

[tt]Jeff's Page [/tt][tt]@[/tt][tt] Code Couch
[/tt]

What is Javascript? faq216-6094
 
Here's my HTML file:

<html>
<head>Test</head>
<body>
<form name="feedback" method="post" action="cgi-bin/feedback.pl">
<p><font size="5"> <font size="4">Your Name:
<input name="name" type="text" id="name">* </font></font></p>
<p> <font size="4">
<input type="submit" name="Submit" value="Submit">
<input type="reset" name="Submit2" value="Reset">
</font></p>
</form>
</body>
</html>

Here's a small perl script that uses the environment variable CONTENT_LENGTH. However, it finds REQUEST_METHOD.

if ($ENV{'REQUEST_METHOD'} eq 'POST') {
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;
}
}

Any ideas what I might be doing wrong?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top