Solved

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

Posted on 1997-11-26
11
177 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
Command Line Tips and Tricks

The command line is a powerful tool at the disposal of every Linux user. Although Linux distros come with beautiful user interfaces, it's worthwhile to learn the command line because it allows you to do a number of things that you otherwise cannot do from the GUI.  

 

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

Give Your Engineering Team a Productivity Boost

Learn why container technology is so powerful and how it can provide your team with productivity gains and other benefits.

Question has a verified solution.

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

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 Windows functions GetTickCount and timeGetTime retrieve the number of milliseconds since the system was started. However, the value is stored in a DWORD, which means that it wraps around to zero every 49.7 days. This article shows how to solve t…
Learn the basics of strings in Python: declaration, operations, indices, and slicing. Strings are declared with quotations; for example: s = "string": Strings are immutable.: Strings may be concatenated or multiplied using the addition and multiplic…
Learn the basics of if, else, and elif statements in Python 2.7. Use "if" statements to test a specified condition.: The structure of an if statement is as follows: (CODE) Use "else" statements to allow the execution of an alternative, if the …

632 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