Solved

Get CGI Form contain variable and email it

Posted on 1997-06-05
9
199 Views
Last Modified: 2010-04-06
I wanna know how to get the number or string on each text area or radio button from form variables. Also how can I send them in simple structured format to my email account.All should created on CGI-BIN Delphi2 with NT 4.0 server only using IIS.YGOLAN already give me guide on how to get environment variable on QUERY_STRING, but I really only get the thingy beside the cgi.exe?xxx=xxx string, but I want to get the strings which we can get from user input when they submit their form.For example I have a query text area asking about user name, and a button for submit it. So what should I do in both HTML and CGI program also how can I send it to my email so I canalerted that user has input their data ??below HTML is what I do now please confirm if there should any change on it :<Form Action="/cgi-bin/cgi.exe" method="post">Your name:<BR><input type="text" name="name"><p><input type="submit" value="ok"></form>Also what I really want received at my email is formated like this below :Name : user_namethats all folks thxx for your attentionI'll appreciate your help.
0
Comment
Question by:anakecil
[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
  • 4
  • 3
  • 2
9 Comments
 

Expert Comment

by:chrb
ID: 1336831
This isn't a answer to your question, but :
Have you tried ISAPI instead of CGI?

Chr
0
 

Author Comment

by:anakecil
ID: 1336832
Thxx for your comment crb, if I can use ISAPI, I will, but I don't know how since I'm newbies on Delphi and website programming.-AnaKecil -
0
 

Expert Comment

by:chrb
ID: 1336833
I am not sure if I'am right but I think the server executes ISAPI's faster and you will get some nice functions :)

Chr
0
Industry Leaders: 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!

 

Author Comment

by:anakecil
ID: 1336834
Yes you right I guess, thought I'm not yet even know about how to program on ISAPI thingy, but I'm sure ISAPI better than CGI since that's why microsoft create it for standard and borland also supported it on Delphi 3. But the thing is my delphi is ver 2.0 so can I still program on ISAPI without any additional thingy, cause I already browse the www.borland.com but I can't get anything ISAPI for my 2.0 version and only for 3.0 available.Also rather than just comment please answer my question if you can my friend :) thxx you very much for your attention.
0
 
LVL 1

Accepted Solution

by:
ygolan earned 50 total points
ID: 1336835
How you retrieve the variable from the form depends on what you specified in the METHOD parameter of the form. If you use "GET", the variables will be encoded on the query string and you can access them as I described before. For example, the following HTML (based on the one you gave) :

<Form Action="/cgi-bin/cgi.exe"
method="get"> Your name:<BR><input type="text" name="name"><p> <input type="submit" value="ok"> </form>

Will produce the following query string, assuming the value in the name field is "ygolan" :

...?name=ygolan

If you use POST instead of GET (<form ... action="post">), reading the values is more complicated, since they are sent in the input stream (stdin) instead of QUERY_STRING. Unless you are sending large (> 1024 bytes) amounts of data, there is no need for you to get into this. However, if you need to do that, just read the data from the stdin - it is in the same format as the query string. The amount of data you should read is specified by the CONTENT_LENGTH environment variable.

Sending the submitted data by mail is a whole different question :-)

I really suggest that you consider using a 3rd party product instead of trying to do it all yourself. There are some pretty good products out there for Delphi 2 and Delphi 3 - I know because I wrote one of them :-)
0
 

Author Comment

by:anakecil
ID: 1336836
Wow okie I sought to try your answer ASAP :)But can you tell me how to create simple"HELLO WORLD" like at CGI in ISAPI usesDelphi 2.0 without any additional thingy component ??nice thxxx you answer excellent - AnaKecil -
0
 
LVL 1

Expert Comment

by:ygolan
ID: 1336837
Library project1;

Uses Classes, SysUtils, Windows, ISAPI;

Function GetExtensionVersion (var pVer : THSE_VERSION_INFO) : BOOL; export; stdcall;
begin
  pVer.dwExtensionVersion := MAKELONG(HSE_VERSION_MINOR, HSE_VERSION_MAJOR);
  StrPCopy(pVer.lpszExtensionDesc, 'Hello World Sample DLL');
  result := true;
end;

Function HttpExtensionProc (var pECB : TEXTENSION_CONTROL_BLOCK) : DWORD; export; stdcall;
const
  HelloMsg : string = 'Hello World';
var
  Size: dword;
  DataType: dword;
begin
  pECB.ServerSupportFunction( pECB.ConnID,
                            HSE_REQ_SEND_RESPONSE_HEADER,
                            nil,
                            Size,
                            DataType);

  Size := Length(HelloMsg);
  pECB.WriteClient( pECB.ConnID, PChar(HelloMsg), Size, 0 );
  result := HSE_STATUS_SUCCESS;
end;
 
exports
  HttpExtensionProc,
  GetExtensionVersion;


begin
end.
0
 

Author Comment

by:anakecil
ID: 1336838
Thxx so much :) I'll try that one for my first ISAPI app. Anyway could you give me description on your email send program ? so I may think about to buy that component :) also tell me can I pay you via VISA CARD ??okie you always excellent- AnaKecil -
0
 
LVL 1

Expert Comment

by:ygolan
ID: 1336839
What I've developed is not a email send component. Instead, it's a framework for developing Web applications using Delphi. It's called WebApp, and you download a preview version from ftp://ftp.hyperact.com/pub/beta/wapprvw.zip.

If you need more information, contact me through ygolan@hyperact.com.


0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

730 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