I have no problem executing a cgi file under the normal url like this:
http://www.myhost.com/mydir/cgi-bin/test.cgi
However when I tried to embedd it into HTML file (called index.html) like this:
<HTML>
<BODY>
<P>Here's the output from my program:
<FORM ACTION="/var/www/mydir/cgi-bin/test.cgi" METHOD=POST>
<!-- This doesn't work also -->
<!-- FORM ACTION="cgi-bin/test.cgi" METHOD=POST-->
</FORM>
</P>
</BODY>
</HTML>
The CGI doesn't get executed when I do:
http://www.myhost.com/mydir/index.html
The CGI file (test.cgi) simply looks like this:
#!/usr/bin/perl -wT
use CGI::Carp qw(fatalsToBrowser);
print "Test cgi!\n";
What's the right way to do it?
The problem is the path you are providing in the action property of the form.
You need to change it to be a path relative to the current document. (index.html)
From your example, it looks like this would be cgi-bin/test.cgi
There isn't a good way to do this in HTML. It is a job better suited for SSI using an exec or virtual directive.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With