Solved

Dynamin Pages under Perl for Win32

Posted on 1997-03-02
2
202 Views
Last Modified: 2013-12-25
Hi,

    that's the first time I am trying to write a CGI. I want the user to enter some information and
    then I would like to return him/her a response. I am developing the CGI in Perl for Win32. As
    I understand it, in the HTML document I write the following:

    <FORM METHOD="POST" ACTION="cgi-local\outtest.pl" TARGET="_parent">
    <INPUT TYPE="TEXT" NAME="_search_string">
    <INPUT TYPE="RESET" VALUE="Clear">
    <INPUT TYPE="SUBMIT" VALUE="Search">
    </FORM>

    then, in the outtest.pl file I write:

    print "Content-type: text/html","\n\n" ;
    print"<html><head>";
    print"<title>CGI Results</title></head><body>";
    print"<h1>Hello, world.</h1>";
    print"</body></html>";

    There is no connection between the output of the CGI and the input of the user. I just want to
    see if I am able to invoke the CGI from the HTML page.

    When I run the ouuttest.pl file on its own it runs fine, but when I want to run it from the
    browser (the HTML page) I do not know how
    print the dynamic page to the user as an HTML page.

    Any information/help would be greatly appreciated

    Ronny Shalev
0
Comment
Question by:rys
2 Comments
 

Accepted Solution

by:
henryj earned 50 total points
ID: 1827733
When the HTML page is shown and the person viewing it presses the submit button the page will attempt to execute the script specified in the action part of the FORM tag. So providing you are running this on a web server (you do need a web server to do this as the page cannot call the script properly without one) it should execute your script.

However, be careful. I noticed you put your script in a directory called /cgi-local - If you are using a MS web server for Win32 this would be the wrong name. MS web servers by default use the directory /scripts for this purpose. Also be certain to check that you have correctly set up PERL as a scripting language for your web server in the registry.

If you need more help then send more details about what the situation is on that machine (ie. wether you are running a server or not)...

rgds,

henry

0
 

Expert Comment

by:nunamakt
ID: 1827734
What web server are you using?  I'm using O'Reilly's WebSite Pro. It's very easy to use (www.ora.com).  I assume you've already made PL the default extension so PERL will be executed with a .PL file.

Make sure your script is in an executable directory.  Website can change where that is.  I assume yours can too.

Oh...I see one more problem.  In PERL, the "\" is a special character.  You have to tell PERL that its not special.. Here's what you have to write instead:

print "Content-type: text/html","\n\n";
print"<html><head>";
print"<title>CGI Results<\/title><\/head><body>";
print"<h1>Hello, world.<\/h1>";
print"<\/body><\/html>";

Give that a try...it should work MUCH better!!!

Tom Nunamaker
nunamakt@toshop.com

0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

It is becoming increasingly popular to have a front-page slider on a web site. Nearly every TV website,  magazine or online news has one on their site, and even some e-commerce sites have one. Today you can use sliders with Joomla, WordPress or …
Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to count occurrences of each item in an array.

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now