Solved

writing a simple win-cgi script for Delphi

Posted on 1997-08-29
3
252 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

[Webinar] Code, Load, and Grow

Managing multiple websites, servers, applications, and security on a daily basis? Join us for a webinar on May 25th to learn how to simplify administration and management of virtual hosts for IT admins, create a secure environment, and deploy code more effectively and frequently.

Question has a verified solution.

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

Shoutout to Emily Plummer (http://www.experts-exchange.com/members/eplummer26.html) for giving me this article! She did most of it, I just finished it up and posted it for her :)    Introduction In a previous article (http://www.experts-exchang…
Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL several years ago, it seemed like now was a good time to update it for object-oriented PHP.  This article does that, replacing as much as possible the pr…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
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.

737 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