Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

OK, here's the situation: I have a perl script which basically takes the input of a form and dumps it to a file.

On my home machine, it works beautifully. Tested it on Apache.

On the server at work (Using IIS 4.0), it works pitifully. It records NO input from Netscape (all the variables are null) and in IE, all the data ends up in the same variable!

Here's the code.

#!C:/usr/bin/Perl use strict; use CGI qw/:standard/; use CGI::Carp qw(fatalsToBrowser set_message); my $log = 'Requests.log'; #All three of these are dif +ferent in the actual script, but that's not the problem my $errors = 'Errors.log'; my $techcontact = ''; #You don't seriously expect me to document what these variable +s contain, do you? my $_name = param( 'name' ); my $_email = param( 'email' ); my $_institution = param( 'institution' ); my $_rank = param( 'rank' ); my $_address = param( 'address'); my $_telnum = param( 'telnum' ); my $_faxnum = param( 'faxnum' ); open LOG, ">> $log" or die " I can't open logfile for append +ing: $! Contact $techcontact at once!"; print LOG "Name: $_name -- Email: $_email -- Institution: $_in +stitution -- Rank: $_rank -- Telnum: $_telnum -- Faxnum: $_faxnum -- +Address: $_address \n"; close LOG; #OK, so here's the problem: In IE, EVERY SINGLE field appears in $_nam +e #In Netscape, these are all blank! Help! What can I do?! print header; print "<HTML>"; print "<HEAD>\n"; print "<TITLE>Registration Received</TITLE>\n"; print "</HEAD>\n"; print "<BODY>\n"; print "<P>&nbsp;</P>\n"; print "<CENTER><H3>Your form has been received successfully.</H3 +><br>\n"; print "Expect a confirmation email with payment instructions in +the next few days."; print "</CENTER><P><P>We received the following information: "; print "<BR>Name: $_name"; print "<BR>Email: $_email"; print "<BR>Institution: $_institution"; print "<BR>Rank: $_rank"; print "<BR>Telephone: $_telnum"; print "<BR>Fax: $_faxnum"; print "<BR>Address: $_address"; print '<P>If this is wrong, try submitting again. If it is still + wrong, send the correct info to'; print "</BODY>\n"; print "</HTML>\n"; #This block of code deals with when the user needs to be smacked w +ith a clue-by-four. BEGIN { sub handle_errors { my $msg = shift; print "<B><I>$msg</I></B>"; print "<P>Try filling out the form again."; } set_message(\&handle_errors); }

Replies are listed 'Best First'.
Re: Confounding CGI input problem
by damian1301 (Curate) on Jul 06, 2001 at 23:15 UTC
    You should really make sure that there is data in those variables and maybe check to see if it is a valid email, etc.

    Other than that, it looks as if it might just be a browser problem.

    $_.=($=+(6<<1));print(chr(my$a=$_));$^H=$_+$_;$_=$^H; print chr($_-39); # Easy but its ok.
      It's almost certainly not a browser problem, since I tested it in both Netscape and IE (Netscape both in Windows and Slackware) on Apache. It works fine then.

      And although it did once test for valid input, I took that out while trying to troubleshoot the problem.

      I appreciate any help anyone could offer me. Thanks.

Re: Confounding CGI input problem
by rrwo (Friar) on Jul 07, 2001 at 00:00 UTC

    Since you're using IIS, I'm assuming it's Windows NT: does the IUSR or IWAM account have write permissions to the file?

    As for your HTML: It's tag soup. You need to end your tags before starting new ones. Also, character elements like B or I are not supposed to be nested, and should be inside block elements like P. (Yes, some browsers will handle bad HTML sometimes, but there's no quarantee or requirement that they should.) Look at the some HTML references.