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 biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Parsing a Form using cgi-lib.pl

Status
Not open for further replies.

BC000

Technical User
May 16, 2006
31
AU
I have used cgi-lib.pl to parse data from an online form. This form has fields in the following order:
Salutation
Name
Surname
Email

However, when I get the result the order of the fields gets distorted. I get it in the following order:
Surname
Email
Name
Salutation

How can I get cgi-lib.pl to give me the results in the same order as the HTML form?

The code I use is as follows:

Code:
#!/usr/bin/perl 
require "cgi-lib.pl"; 
&ReadParse; 

print "Content-type: text/html\n\n"; 

print <<"PrintTag"; 
<HTML> 
<HEAD> 
<TITLE>Testing Form Input</TITLE> 
</HEAD> 
<BODY> 
<TABLE> 
PrintTag 

foreach $key (keys(%in)) 
{ 
print <<"PrintTag"; 
<TR> 
<TD>$key</TD> 
<TD>$in{$key}</TD> 
</TR> 
PrintTag 
} 

print <<"PrintTag"; 
</TABLE> 
</BODY> 
</HTML> 
PrintTag

Yes, I am from the old school and still use cgi-lib.pl. So please excuse me.
 
I just answered this question on the other forum you posted it on.

------------------------------------------
- Kevin, perl coder unexceptional! [wiggle]
 
I have just replied to you in the other forum. Please have a look and help me if you can. Thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top