Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses

Form Stopped working

by jenlear (Initiate)
on Apr 04, 2017 at 15:11 UTC ( #1186999=perlquestion: print w/replies, xml ) Need Help??

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

I have a form that uses, All I did was go in and change the email addresses that the results should go to, and now it returns a Internal server error. Not sure what to do.

I restored it with a backup and It still returns an error.

I reset the permissions to 644. Still no luck. Anyone able to help?

Part of code changed:

my $emailTo = 'Customer Service <>'; my $emailFrom = FilterCChars($FTGEmail); open(MAIL,"|$mailProg"); print MAIL "To: $emailTo\n"; print MAIL 'Cc: Frank Simmons <,susan@ftiegs. +com,> . "\n"; print MAIL "From: $emailFrom\n"; print MAIL "Subject: $emailSubject\n"; print MAIL "Content-Type: text/plain; charset=\"UTF-8\"\n"; print MAIL "Content-Transfer-Encoding: 8bit\n"; print MAIL "\n"; print MAIL $emailBody; close(MAIL); # Redirect user to success page print "Location: /thankyou.html\n\n"; exit;

Replies are listed 'Best First'.
Re: Form Stopped working
by poj (Abbot) on Apr 04, 2017 at 15:22 UTC

    Look very carefully at the quote at the end of this line

    'Cc: Frank Simmons &lt;,,>
      Ahhhh let me see if it will work now...
      Very nice catch!! Thank you soon much!

        You might consider making the script more consistent with a variable

        my $emailCC = 'Any Person <,,so>'; print MAIL "To: $emailTo\n"; print MAIL "Cc: $emailCC\n"; . .
      A) Welcome to the monastery, jenlear!
      B) As poj is pointing out, curly quotes (sometimes called "smart quotes") are not the same as straight quotes in Perl. You'll have a lot easier time if you find a programming-oriented text editor program that doesn't change your straight quotes to curly ones. If we knew what OS you were using, maybe we could suggest a good one.

      Nice catch!

Re: Form Stopped working
by kennethk (Abbot) on Apr 04, 2017 at 15:53 UTC
    poj appears to have solved the issue. A comment about form: please note that you did not close your code block (</code>). You avoid a lot of formatting issues if you use properly balanced <code> tags.

    #11929 First ask yourself `How would I do this without a computer?' Then have the computer do it the same way.

Re: Form Stopped working
by stevieb (Canon) on Apr 04, 2017 at 15:23 UTC

    When the error occurs, what does the web server's log file say about the problem? Almost always, the answer is in the server's error log.

      This only said Internal Server Error, contact administrator about the problem...

      Thats the first thing I look for, a message in the error, but this didn't give any hints.

      "curly" quote killed the script. Typo.

        What happened when you contacted the administrator? On a serious note, the webserver error logs likely contain the relevant information. "All I did was go in and change the email addresses that the results should go to". It's important to be able to limit the scope of what you change, and check that nothing else has been altered by accident. Keeping an original and an edited version, comparing them with diff (or similar tool) is very handy.

        Do you have access to the server command line? You can check the syntax of a script without running it with the -c flag.

        #11929 First ask yourself `How would I do this without a computer?' Then have the computer do it the same way.

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://1186999]
Approved by Corion
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (3)
As of 2021-12-09 04:33 GMT
Find Nodes?
    Voting Booth?
    R or B?

    Results (36 votes). Check out past polls.