Solved

writing a simple win-cgi script for Delphi

Posted on 1997-08-29
3
253 Views
Last Modified: 2013-11-18
I have created an HTML form with 3 text boxes.  I want to submit these inputed values to a win-cgi program that will take the name value pair and show the user what he entered.

My OS is win 95 and I am running MS Personal Web Server 1.0a

Thanks
0
Comment
Question by:scottwatson
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 4

Accepted Solution

by:
itamar earned 50 total points
ID: 1342993
You might want to start with this site.  It contains some good information on starting basic for developing a CGI applicaiton...

http://www.borland.com/delphi/news/cobb/ddj1_6b/ddj1_6b.html

or, you can check the code below (from Erik Johnson):

PROGRAM Hello;

//Credits to Erik Johnson (erik@phidias.colorado.edu)

USES Windows, SysUtils;

FUNCTION GetEnvVar( KeyStr : STRING ) : STRING;
 // a routine to simplify accessing environment information
 CONST maxlen = 1024; // whatever the max length you need is
 VAR  buf : ARRAY[0..maxlen] OF Char;
 BEGIN
   IF GetEnvironmentVariable( PChar( KeyStr),Buf,maxlen) > 0 THEN
      Result := StrPas( Buf )
   ELSE
      Result := '';
 END;

BEGIN
   AllocConsole; // or use apptype compiler directive
   writeln('Content-type: text/html'); // required html header
   writeln(''); //required html header

   // you can now Writeln & Write whatever html you want...
   Writeln( '<TITLE>hello page</TITLE>' );
   Writeln( '<b>Hello World</b>' );
   Writeln( '<br>' );
   Writeln( 'query='+GetEnvVar('QUERY_STRING' ));
END.

Different webservers supply different environment variables... some
common ones are...
'CONTENT_TYPE','GATEWAY_INTERFACE','HTTP_ACCEPT','',
'QUERY_STRING','REMOTE_ADDR','REMOTE_HOST',
'REMOTE_USER','REQUEST_METHOD','SCRIPT_NAME',
'SERVER_NAME','SERVER_PROTOCOL','SERVER_SOFTWARE','REFERER'

Credits to Erik Johnson (erik@phidias.colorado.edu)
0
 

Author Comment

by:scottwatson
ID: 1342994
Could you explain how the Cobb example works.  I entered the code word for word but my out page ends with ERROR.  I must add that I used a HTML form to try and input the 3 text boxes into the INI file.  Am I supposed to be using the post or get Action Method?  Do I include the location of the 3 files as parameters of my cgi program within my HTML code.
0
 
LVL 4

Expert Comment

by:itamar
ID: 1342995
You must use the POST method.
You don't need to include the location of the 3 files, your Web server will do it for you. That's the way Win-Cgi works.

As if you can check in the code, the program sets the contents of a variable with the string 'ERRO' whenever it doesn't find the ocurrency of a Input Type in the input INI file. Check if you are using exactly the same name of the input types in the ReadString parameters.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Introduction Knockoutjs (Knockout) is a JavaScript framework (Model View ViewModel or MVVM framework).   The main ideology behind Knockout is to control from JavaScript how a page looks whilst creating an engaging user experience in the least …
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Suggested Courses

617 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