CGI crew get here vs. my 500 internal error :wtc:

Discussion in 'OT Technology' started by elevator, May 7, 2007.

  1. elevator

    elevator The tenants think it's wonderful! ヽ(´ OT Supporter

    Joined:
    Mar 25, 2005
    Messages:
    10,967
    Likes Received:
    0
    Location:
    Houston, TX
    So I'm a newb at cgi and I am suppose to write a SIMPLE script that will calculate Fahrenheit into Celsius, viceversa depending on the user's entry on a web form.
    My HTML code (for the form):
    Code:
    <HTML>
     <HEAD><TITLE>Daniel's Temperature Converter 1</TITLE>
     </HEAD>
     <BODY Background="background.gif">
     <H3>
     <FORM METHOD=POST ACTION="tempperl.cgi">
     <input NAME="degrees" TYPE=text size="10"><BR>
     <input NAME="choices" TYPE=radio value="F"> Convert to Fahrenheit<BR>
     <input NAME="choices" TYPE=radio value="C"> Convert to Celsius<BR>
     <INPUT TYPE=submit value="Submit">
     <INPUT TYPE=reset value="Reset">
     
     </FORM>
     </H3>
     
     
     <HR></BODY></HTML>
     
    My CGI script:
    Code:
    #!/usr/bin/perl
     
     use CGI qw/:standard/;
     
     $deg = param(degrees);
     $FoC = param(choices);
     
     if ($FoC eq "F")
         {
         $out = (1.8 * $deg) + 32;
         }
     else
         {
         $out = ($deg - 32) / 1.8;
         }
     
     print header;
     print "<BODY>"
     print "$out </BODY></HTML>"
     
     
    My perl -wc tempperl.cgi errors
    Code:
    Unquoted String "degrees" may clash with future reserved word at tempperl.cgi line 5.
     Unquoted String "choices" may clash with future reserved word at tempperl.cgi line 6.
     syntax error at tempperl.cgi line 19, near "print"
     tempperl.cgi had compilation errors.
     
    I've been googling for hours and haven't found my problem.
    thanks ot :wiggle:
     
  2. Peyomp

    Peyomp New Member

    Joined:
    Jan 11, 2002
    Messages:
    14,017
    Likes Received:
    0
    $deg = param("degrees");
    $FoC = param("choices");

    ?
     
  3. elevator

    elevator The tenants think it's wonderful! ヽ(´ OT Supporter

    Joined:
    Mar 25, 2005
    Messages:
    10,967
    Likes Received:
    0
    Location:
    Houston, TX
    Thanks for taking a shot at it but I just forgot to end my print lines with ; :o
     
  4. sparq

    sparq New Member

    Joined:
    Dec 3, 2004
    Messages:
    13,183
    Likes Received:
    0
    Location:
    Syracuse
    I was going to type this before scrolling down and seeing that you got it. :bigthumb:
     

Share This Page