Solved

Get CGI Form contain variable and email it

Posted on 1997-06-05
9
196 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
 

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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.
Both in life and business – not all partnerships are created equal. As the demand for cloud services increases, so do the number of self-proclaimed cloud partners. Asking the right questions up front in the partnership, will enable both parties …

911 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now