Solved

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

Posted on 1997-11-26
11
175 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
Resolve Critical IT Incidents Fast

If your data, services or processes become compromised, your organization can suffer damage in just minutes and how fast you communicate during a major IT incident is everything. Learn how to immediately identify incidents & best practices to resolve them quickly and effectively.

 

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

The Orion Papers

Are you interested in becoming an AWS Certified Solutions Architect?

Discover a new interactive way of training for the exam.

Question has a verified solution.

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

Introduction This tutorial will give you a fast look what you can do with WhizBase. I expect you already know how to work with HTML at least, and that you understand the basics of the internet and how the internet works. WhizBase is a server-s…
This tutorial will discuss fancy secure registration forms, with AJAX technology support. In this article I assume you already know HTML and some JS. I will write the code using WhizBase Server Pages, so you need to know some basics in WBSP (you mig…
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

729 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