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
Solved

Get CGI Form contain variable and email it

Posted on 1997-06-05
9
198 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
  • 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
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 

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: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

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

Title # Comments Views Activity
How to fill array with TArray.Create? 14 94
Process Javascript errors with Delphi TWebBrowser 1 174
Delphi Yen format 3 45
Multi-layered image in FireMonkey 9 48
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

808 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