writing a simple win-cgi script for Delphi

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

Who is Participating?
itamarConnect With a Mentor Commented:
You might want to start with this site.  It contains some good information on starting basic for developing a CGI applicaiton...


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


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

USES Windows, SysUtils;

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

   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' ));

Different webservers supply different environment variables... some
common ones are...

Credits to Erik Johnson (erik@phidias.colorado.edu)
scottwatsonAuthor Commented:
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.
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.
All Courses

From novice to tech pro — start learning today.