Solved

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

Posted on 1997-11-26
11
167 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
  • 6
  • 3
  • 2
11 Comments
 
LVL 5

Expert Comment

by:julio011597
Comment Utility
Would you accept a C function?
0
 

Author Comment

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

Expert Comment

by:df020797
Comment Utility
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
 

Author Comment

by:thomasschmidt
Comment Utility
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
Comment Utility
BTW, if you are satisfied with my code, would you mind letting me post it as an answer?
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 5

Expert Comment

by:julio011597
Comment Utility
To df:

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

Expert Comment

by:julio011597
Comment Utility
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
Comment Utility
You just reject his answer, so i'll be able to submit mine as the answer.
0
 
LVL 5

Expert Comment

by:julio011597
Comment Utility
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
Comment Utility
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
Comment Utility
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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Ever wondered how to display how many visitors you have online. In this tutorial I will show you an easy but effective way to display the number of online visitors in WhizBase. In this article I assume you have read my previous articles and know …
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 fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
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 …

762 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

6 Experts available now in Live!

Get 1:1 Help Now