My form should allow the user to enter the fahrenheit or celsius degrees in a text box. I have the html page with text boxes done, but once it's entered, the converted temp should be displayed on another Web page and that's the problem I'm having. I get a misconfiguration error. Hopefully I've explained this correctly.
Here's my code and errors:
CODE
#!usr/bin/perl
#c07case1.cgi- converts Fahrenheit/Celsius temps on a dynamic Web page
print "Content-type:text/html\n";
use CGI qw(:standard -debug);
use strict;
#declare variables
my ($fahr, $cels, $temp);
($fahr, $cels)=get_form_data();
$temp = calc_temp();
create_web_page();
exit;
****user-defined functions****
sub get_form_data {
return param('Temperature');
}#end get_form_data
sub calc_temp {
my ($fahr,$cels);
$fahr = $_[0];
$cels = ($temp -= 32) * = 5/9;
my ($fahr,$cels);
$fahr = $_[0];
$cels = ($fahr - 32) * 5/9;
if ($fahr = "") {
$temp = $cels;
return $cels
}
return Celsius;
elseif ($cels = $fahr - 32) * 5/9) {
$temp = $fahr;
return $fahr;
} #end calc_temp
sub display_temp {
print "<html>\n";
print "<head><title>Washington Middle School</title></head>\n";
print "<body>\n";
print "$fahr degrees Fahrenheit is $cels degrees Celsius or
print "$cels degrees Celsius is $fahr degrees Fahrenheit..\n";
}
print "</body></html>\n";
#end display_temp
Operator or semicolon missing before *user at c07.cgi line 15.
Ambiguous use of * resolved as operator * at c07.cgi line 15.
syntax error at c07.cgi line 16, near "sub get_form_data "
c07.cgi had compilation errors.