"Jon Howe" <[EMAIL PROTECTED]> wrote: >Is possible to have a cgi-perl script return the html form values + names, in the >same order in which they appearfo in the html rm supplying the post with out having >to >refer to each hash/array element.
You probably have to write your own parsing routine, something like sub parse_form_data{ my (@p, $input, $pair, $field, $value); if ($ENV{'REQUEST_METHOD'} eq "GET") { $input = $ENV{'QUERY_STRING'} } else { read(STDIN, $input, $ENV{'CONTENT_LENGTH'}) } foreach $pair ( split(/&/, $input) ) { ($field, $value) = split(/=/, $pair); $field =~ s/%([\dA-Fa-f]{2})/pack("C", hex($1))/eg; $value =~ tr/+/ /; $value =~ s/%([\dA-Fa-f]{2})/pack("C", hex($1))/eg; push @p, $field, $value; } return(@p); } #and then call @data = &parse_form_data; If someone knows in which order are hashes loaded I would also like to know. >An example of what I am Woking with : > >########################## > >/usr/bin/perl -w > >use CGI_Lite; > >$cgi = new CGI_Lite (); > >%data = $cgi->parse_form_data (); > >@data = %data; > >open(SENDMAIL, "|/usr/lib/sendmail") > or die "can't fork for sendmail: $!\n"; > >print SENDMAIL <<"EOF"; >From: blah >To: blah >Subject: STUFF > >@data > >EOF > >close(SENDMAIL) or warn "its all GONE WRONG!!!!!!!"; > >############################################# > >I could reefer to each element of %data $data{whatever value} individually but this >seems a bit laborious. > >It would be nice to have a ordered array I could pass straight out. -- Matija -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]