Solved

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

Posted on 1997-11-26
11
168 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
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
 

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
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 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

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

Suggested Solutions

Title # Comments Views Activity
Convert OverPunch 25 62
How can I do this in Pyhton? 12 109
AWS CLI - Instances, Volumes & Tagging 2 71
Some AHK commands fail in Microsoft OneNote 5 28
The following is a collection of cases for strange behaviour when using advanced techniques in DOS batch files. You should have some basic experience in batch "programming", as I'm assuming some knowledge and not further explain the basics. For some…
This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

943 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