Solved

Getting form data from a CGI script written i C++

Posted on 1997-11-26
11
172 Views
Last Modified: 2013-12-25
What is the easiest way to get form data from a cgi script written in c++ (VC5.0), i would like to create a function that i could call like this GetFormData(formfieldname) and it would return the value for the formfieldname(it doesn't matter whether its post or get). It is very easy in Visual Basic, but i am new to c++ and would really like some help with the aid of some source code or a hint to what i should do.
0
Comment
Question by:thomasschmidt
[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
  • 6
  • 3
  • 2
11 Comments
 
LVL 5

Expert Comment

by:julio011597
ID: 1831425
Would you accept a C function?
0
 

Author Comment

by:thomasschmidt
ID: 1831426
Yes please, and thank you very much!
Thomas
0
 
LVL 2

Expert Comment

by:df020797
ID: 1831427
Data from a form is sent in this form:
var1=value1&var2=value2&var3=value3&...&varn=valuen
where varx is the names fields in the form and the valuex is the values typed into the form from the browser.

This data is transfered in two ways.

If the method=GET its stored in the enviroment variable QUERY_STRING and if the method=post its sent via stdin

0
Forrester Webinar: xMatters Delivers 261% ROI

Guest speaker Dean Davison, Forrester Principal Consultant, explains how a Fortune 500 communication company using xMatters found these results: Achieved a 261% ROI, Experienced $753,280 in net present value benefits over 3 years and Reduced MTTR by 91% for tier 1 incidents.

 

Author Comment

by:thomasschmidt
ID: 1831428
I am using the get method. I was wondering what the easiest method to "dekode" the QUERY_STRING is, so i could use a function to call with the var and get the value back, it is just because i am a lousy c++ programmer i have done the same in the Visual Basic and its not so difficult.
0
 
LVL 5

Expert Comment

by:julio011597
ID: 1831429
BTW, if you are satisfied with my code, would you mind letting me post it as an answer?
0
 
LVL 5

Expert Comment

by:julio011597
ID: 1831430
To df:

yours is not an answer, so why did not you just post a comment??
0
 
LVL 5

Expert Comment

by:julio011597
ID: 1831431
Thank you Julio, nut how do i give you the points, I am only allowed to give the points to DF (no offense)??????
0
 

Author Comment

by:thomasschmidt
ID: 1831432
You just reject his answer, so i'll be able to submit mine as the answer.
0
 
LVL 5

Expert Comment

by:julio011597
ID: 1831433
Mineis also an answer... I just didnt enter code... I told him hwo it works... much better than just copying someones code and dotn usertsand what it does...

0
 
LVL 2

Expert Comment

by:df020797
ID: 1831434
Thanks.

The code works well and _fast_ as is.

Just get rid of that '{' at the line:

"if(*curs == '=') {"

Regards.

0
 
LVL 5

Accepted Solution

by:
julio011597 earned 50 total points
ID: 1831435
df:

The question was:

"i would like to create a function that i could call like this GetFormData(formfieldname) and it would return the value for the formfieldname..."

Do you really think your was an answer?
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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

Recently I have been answering a lot of questions like this in IT forums that I frequent. The question posed is usually something along the lines of "We have software X installed and need to uninstall it for reason Y" or some other variant of the sa…
In this tutorial I will show you how to make a simple HTML bar chart with the usage of WhizBase, If you want more information about WhizBase please read my previous articles at http://www.experts-exchange.com/ARTH_5123186.html (http://www.experts-ex…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

732 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