I am running a form-to-email script and the data sent to the email address arrives in 
random order. I can't determine how the script is selecting the order in which it is 
sent. What do I need to do to send the data line-by-line in the order it appears on 
the form?
Thanks,
Larry M.

Here is the script:
(I know there are violations of good programming standards violated in this code(such 
as "use strict") 
but I have to upgrade to a newer version of perl and add the modules that I don't 
have. This will be done before the form is released to the world.)

#!/usr/bin/perl

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

  read (STDIN, $buffer, $ENV{'CONTENT_LENGTH'});

  @pairs = split(/&/, $buffer);

 foreach $pair (@pairs) {

  ($name, $value) = split (/=/, $pair);

  $value =~ tr/+/ /;

  $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; 

  $FORM{$name} = $value;

  }

$to = '[EMAIL PROTECTED]' ;

$subject = 'Application' ;

$contents = 'Contents' ;

open (MAIL, "|/usr/sbin/sendmail -t") || &ErrorMessage;

print MAIL "To: $to\n";

print MAIL "Subject: $subject\n";

print MAIL "$contents\n";

foreach $key (keys(%FORM)) {

 print MAIL "$key = $FORM{$key}\n";

}

close (MAIL);

print "Thank you for applying.";

sub ErrorMessage {

 print "<P>The server has a problem. Aborting script. \n";

 exit;

}

Reply via email to