--- "Simon K. Chan" <[EMAIL PROTECTED]> wrote:
> Curtis,
> 
> Your suggestion does not seem to work for me.  My apologies for sending you the 
>script, but the 
> my @food = param('food'); does not work for me!  Any and all suggestions would be 
>much
> appreciated.

Simon,

No problem about sending the script.  It's short and the problem was easy to spot.

When sending data via a POST request, the data is available through STDIN.  Unless you 
do some
really fancy footwork with Perl, that data is only available to be read once.  Here's 
what's
causing the  problem:

    &ReadParse(*input);
    my @array = param('food');

Once you start using CGI.pm, you can drop the &ReadParse.  That reads the data in 
STDIN and CGI.pm
has no data left to read.  Get rid of that and it should work fine.

Also, the &ReadParse routine has many bugs in it.  I won't go into it at length right 
now, but
it's seen all over the place and, unfortunately, it's resulted in a lot of buggy code 
out there. 
Your content type line is also incorrect:

    print "Content-type:text/html\n\n";
 
That should have a space between the colon and the word 'text'.  If it works for you, 
you're
benefitting from error correction that many browsers have built in.  It's such a 
common error that
browsers often figure it out.  Since you're using CGI.pm, you can just use the 
following:

    print header();

Incidentally, I know of at least one case where the above line resulted in a 
"text/plain" header. 
To force the correct header, if that happens, you can do this:

    print header( -type => 'text/html' );

Cheers,
Curtis "Ovid" Poe


=====
Senior Programmer
Onsite! Technology (http://www.onsitetech.com/)
"Ovid" on http://www.perlmonks.org/

__________________________________________________
Do You Yahoo!?
Make international calls for as low as $.04/minute with Yahoo! Messenger
http://phonecard.yahoo.com/

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

Reply via email to