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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CGI Script Show Source

Status
Not open for further replies.

rhnewfie

Programmer
Jun 14, 2001
267
CA
I have a simple web form and cgi script that processes the info but when I call my script from the form action the page that comes up shows the source of the script?? I'm new to this so any help will be appreciated!! The script that I am testing simply prints out a thank-you page but doesn't do the processeing. This is what I see:

#!C:/perl/bin/perl.exe

print "Content-type: text/html\n\n";
print &quot;<HTML>\n&quot;;
print &quot;<HEAD>\n&quot;;
print &quot;<TITLE>Thank You!</TITLE>\n&quot;;
print &quot;</HEAD>\n&quot;;
print &quot;<BODY BGCOLOR=#FFFFCC TEXT=#000000>\n&quot;;
print &quot;<H1>Thank You!</H1>\n&quot;;
print &quot;\n&quot;;
print &quot;<P>\n&quot;;
print &quot;<H3>Your feedback is appreciated.<BR>\n&quot;;
print &quot;<P>\n&quot;;
print &quot;</BODY>\n&quot;;
print &quot;</HTML>\n&quot;;
exit(0);

Thanks
RHNewfie There are 3 Types of People in the World
Those Born to Think Logically
Those that can Learn to Think Logically
Those that Shouldn't Try
 
As an extra note

I got the above to work after but now this causes the same problem

#!C:/perl/bin/perl.exe

if ($ENV{'REQUEST_METHOD'} eq 'POST') {

read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});

@pairs = split(/&/, $buffer);

foreach $pair (@pairs) {
($name, $value) = split(/=/, $pair);
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack(&quot;C&quot;, hex($1))/eg;

$FORM{$name} = $value;
}


&thank_you;
}




#The following creates the Thank You page display

sub thank_you {

print &quot;Content-type: text/html\n\n&quot;;
print &quot;<HTML>\n&quot;;
print &quot;<HEAD>\n&quot;;
print &quot;<TITLE>Thank You!</TITLE>\n&quot;;
print &quot;</HEAD>\n&quot;;
print &quot;<BODY BGCOLOR=#FFFFCC TEXT=#000000>\n&quot;;
print &quot;<H1>Thank You!</H1>\n&quot;;
print &quot;\n&quot;;
print &quot;<P>\n&quot;;
print &quot;<H3>Your feedback is greatly appreciated.<BR>\n&quot;;
print &quot;<P>\n&quot;;
print &quot;</BODY>\n&quot;;
print &quot;</HTML>\n&quot;;
exit(0);
} There are 3 Types of People in the World
Those Born to Think Logically
Those that can Learn to Think Logically
Those that Shouldn't Try
 
Hi,

Well the simple one works fine standalone to me. The second has an associated html form so its difficult to test in isolation, however it looks OK at first glance.

The key thing is that the <Directory> container for the directory in which the scripts reside is defined within httpd.conf as having :

AddHandler cgi-script cgi pl
Options +ExecCGI

Otherwise, it would just be treated as the default content type and displayed as text.

Hope this helps

 
That did help a little. Now I don't get an error message but my browser seems to go away and do somehting for a loooong time. Thanks for your help. There are 3 Types of People in the World
Those Born to Think Logically
Those that can Learn to Think Logically
Those that Shouldn't Try
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top