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

embed a CGI script inside an HTML page 3

Status
Not open for further replies.

nix45

MIS
Nov 21, 2002
478
US
I have a Perl/CGI script that generates a drop down list (form) after gathering certain information from the OS. I want to add this script to the top of a regular HTML page and have it execute before the HTML page loads. Right now, I have to call it manually in the browser, I did a little research and it looks like I might be able to do this with an 'include' statement, but I think that only works with SHTML pages. I'm not that familiar with SHTML.

What are my options here?

Thanks,
Chris
 
You can either call your script from a Server Side Include

<!--#exec cmd=&quot;your script here&quot;-->

or

embed your HTML page within the script


#!/usr/bin/perl -w

use strict;

print &quot;content-type:text/html\n\n&quot;;
print <<EOF;
<html>
<head>
<title>Test</title>
</head>
<body>

<select type=1 name=pulldown>
EOF;

####################################

sub { Add your perl logic here }

####################################

print <<EOF;
</select>

</body>
</html>
EOF;




 
New to SSI?

You'll need to make sure that your server permits SSI (Server Side Includes)

SHTML is basically the extension you give a HTML file with an embedded SSI, so the webserver knows that it has to do something different

Check the documentation for your webserver

Regards
--Paul
 
If you use SSI's, do you have to use the .shtml extension?

Thanks,
Chris
 
If you're using apache I think you do, but I'm not 100% sure

What webserver are you using?

--Paul
 
YOu define in the httpd.conf what file extensions get processed as SSI. It defaults to .shtml but you can add others (.html if your masochistic).

Like Paul said ,Docs..
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top