Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Any idea why this basic perl script isn't working on my site?

Status
Not open for further replies.

Mizugori

Programmer
May 21, 2007
56
0
0
US
Code:
#! /usr/local/bin/perl
use strict;
use CGI ':standard';

my $c = new CGI;
my $theme = $c->param('choice')

if ($theme)
{
        if ($theme == "opt1")
        {
                print '<body background="name.jpg">'
        }

        else if ($theme == "opt2")
        {
                print '<body bgcolor="#000000">'
        }
        print 'Test!'
}

I'm getting an internal server error 500... can't access the error log either. Any suggestions?? I was trying to use a simple form to set the background based on what they typed into a input text box...
 
You need to print an http header and there are other problems:

Code:
#!/usr/local/bin/perl
use strict;
use CGI ':standard';

my $c = new CGI;
my $theme = $c->param('choice');

[b]print $c->header[/b];

if ($theme)
{
        if ($theme [b]eq[/b] "opt1")
        {
                print '<body background="name.jpg">';
        }

        [b]elsif[/b] ($theme [b]eq[/b] "opt2")
        {
                print '<body bgcolor="#000000">';
        }
        print 'Test!';
}
print $c->end_html;

------------------------------------------
- Kevin, perl coder unexceptional! [wiggle]
 
#!/usr/local/bin/perl
use strict;
use CGI ':standard';

my $c = new CGI;
my $theme = $c->param('choice');

print "Content-type: text/html\n\n";

print <<"EOL";
<body>

</body>
EOL
exit;

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top