The foreach at the end is your alphabetical problem.  But, there is
another problem here.  If you don't use foreach $key (sort
keys(%formdata)) { the keys will be in a random order.  You'll need to
tie the %formdata has using the Tie::IxHash module.  Example:

#!c:/perl/bin/perl -w
use strict;
use Tie::IxHash;
tie my %formdata, "Tie::IxHash";

# Read data into %formdata here
foreach my $key (keys %formdata) {
  print "<P>The field named: <B>$key</B> contained:";
  print "<U><B>$formdata{$key}</B></U>";
}

This will give it to you in insertion order.  Very, very, very handy.
:o)

As for your line near the top, try this in your code:

my($sec,$min,$hours,$day,$month,$year) = (localtime)[0,1,2,3,4,5];
printf("At %02d:%02d:%02d, on %02d/%02d/%04d, $who submitted this
request for a $quote quote", $hour,$min,$sec,$month+1,$day,$year+1900);

Take a look at the Net::SMTP module for help with sending email.  And
no, this isn't very secure.  Any time you send anything over email, it's
send plain text and therefore is insecure.  Plus I'm guessing you are
not using a secure web site, so that as well is being sent plain text.

Brian Johnson
Partner/Systems Administrator/Programmer
Source1Hosting.tv, LLC (www.source1hosting.tv)
Source1Results.com, LLC (www.source1results.com)
I may be insane, but remember - The only
difference between an insane man and a
genius is his jacket.

> Hey all! Thanks for everybody's help so far! Finally got the 
> parsing script
> to work! Very excited about that. As a new perl programmer, 
> my confidence is
> rising. Just used a cut & paste script, but had to 
> reconfigure.  At least I
> know what each line of code does (or think I do anyway).  
> Heard that cgi.pm
> is better, but am still learning how to use it.  Any suggestions?
> In the meantime, however, the script prints the form field values in
> alphabetical order.  I want it to print in the actual order I 
> have it listed
> on the form.  What to do?
> And, in the header of the returned values, I would like the 
> script to say
> something like:
> At (hh:mm:ss), on (mm/dd/yyyy), "So and So" submitted this 
> request for a
> "bla-bla" Quote.
> 
> Also, I don't want the customer to see the returned values; I 
> want them
> emailed to me. Once they click the submit button, I just want 
> a page to come
> up that says "Thank you for your request", and so forth and 
> so on.  Also, is
> this very secure?
> 
> Could cgi.pm take care of all of this?
>             Thanks for your help.
>             Nathan,
>             [EMAIL PROTECTED]
> <mailto:[EMAIL PROTECTED]>
>             www.tandrtrailer.com <http://www.tandrtrailer.com/>
> 
> Code follows:
> 
> #!c:/perl/bin/perl -w
> 
> if ($ENV{'REQUEST_METHOD'} eq 'GET')
>             {
>   @pairs = split (/&/,
>     $ENV{'QUERY_STRING'});
> }  elsif ($ENV{'REQUEST_METHOD'} eq
>   'POST') {
>   read (STDIN, $buffer,
>             $ENV{'CONTENT_LENGTH'});
>   @pairs = split(/&/, $buffer);
> } else {
>   print "Content-type: text/html\n\n";
>   print header;
>   print "<P>Use Post or Get";
> }
> 
> foreach $pair (@pairs) {
>   ($key, $value) = split (/=/, $pair);
>   $key =~ tr/+/ /;
> 
> # Are these next few lines part of my "alphabetical" problem?
> 
>   $key =~ s/%([a-fA-F0-9] [a-fA-F0-9])/
>             pack("C", hex($1))/eg;
>   $value =~ tr/+/ /;
>   $value =~s/%([a-fA-F0-9] [a-fA-F0-9])/
>             pack("C", hex($1))/eg;
> 
>   $value =~s/<!--(.|\n)*-->//g;
> 
>   if ($formdata{$key}) {
>             $formdata{$key} .= ", $value";
>   } else {
>             $formdata{$key} = $value;
>   }
> }
> 
> print "Content-type: text/html\n\n";
> print header;
> foreach $key (sort keys(%formdata)) {
>   print "<P>The field named: <B>$key</B> contained:
> <U><B>$formdata{$key}</B></U>";
> }
> 
> 


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to