Solved

forms and passing variable to my program

Posted on 2000-04-22
8
159 Views
Last Modified: 2013-12-25
Hi. I am trying to develop a CGI application in C++. The info on CGI in C++ that I have found is very limited. So I am basically trying to understand it from CGI with Perl. I got a few questions regarding this form I have made and the program I am developing.
tHis is the form:
<html>

      <head>
            <meta http-equiv="content-type" content="text/html;charset=iso-8859-1">
            <meta name="generator" content="Microsoft FrontPage 4.0">
            <title>Search Engine</title>
      </head>

      <body>
            <input src="(Empty Reference!)" type="image">
            <p><input type="text" name="textfieldName" size="24"> <input type="submit" name="submitButtonName"></p>
            <p><input type="checkbox" value="checkboxValue" name="checkboxName">By Name</p>
            <p><input type="checkbox" value="checkboxValue" name="checkboxName">By Location
      </body>

</html>

Questions:

1. How do I use that form with my C++ program?
2. How in my program I would receive the data entered in the form. For example, if the person enters United States, how do I passed this value to my program?

0
Comment
Question by:bea_pr
  • 4
  • 3
8 Comments
 
LVL 1

Expert Comment

by:lambda
Comment Utility
You don't have a form tag in the code... Use the form action as the name of the cgi pgm u want to call.

<html>
                    <head>
                    <meta http-equiv="content-type" content="text/html;charset=iso-8859-1">
                    <meta name="generator" content="Microsoft FrontPage 4.0">
                    <title>Search Engine</title>
                    </head>

                    <body>
                    <form action="/cgi-bin/mypgm.cgi" method="post">
                    <input src="(Empty Reference!)" type="image">
                    <p><input type="text" name="textfieldName" size="24"> <input type="submit"
                    name="submitButtonName"></p>
                    <p><input type="checkbox" value="checkboxValue" name="checkboxName">By Name</p>
                    <p><input type="checkbox" value="checkboxValue" name="checkboxName">By Location
                    </form>
                    </body>

                    </html>

£.
0
 
LVL 23

Accepted Solution

by:
chensu earned 80 total points
Comment Utility
There are a lot of CGI libraries to help you do it. They come with samples and tutorials. For example,

GNU Cgicc
http://www.gnu.org/software/cgicc/cgicc.html

cgiClass
ftp://www.math.unh.edu/pub/black/cgiClass
0
 
LVL 23

Expert Comment

by:chensu
Comment Utility
Tips, instructions and tutorials on programming CGI in C and C++
http://cgi.resourceindex.com/Documentation/Programming_in_C_and_C++/
0
 

Author Comment

by:bea_pr
Comment Utility
I got the cgicc library, but I haven't been able to figure how to make it work with my program.
0
6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

 

Author Comment

by:bea_pr
Comment Utility
do you know how it works?
0
 

Author Comment

by:bea_pr
Comment Utility
If so can you explain?
0
 
LVL 23

Expert Comment

by:chensu
Comment Utility
I would suggest you take a look at the tutorials first.

http://cgi.resourceindex.com/Documentation/Programming_in_C_and_C++/

Cgicc's documentation is at

http://www.gnu.org/software/cgicc/cgicc-doc.html

There is a tutorial as well.
0
 

Author Comment

by:bea_pr
Comment Utility
I'll look at them
thanx
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

In this tutorial I will aim to show you how simple is making a small application in WhizBase, how to add, remove and update data in the DB. I will make a small address book application where you can add, browse, update and remove addresses. I wi…
Batch, VBS, and scripts in general are incredibly useful for repetitive tasks.  Some tasks can take a while to complete and it can be annoying to check back only to discover that your script finished 5 minutes ago.  Some scripts may complete nearly …
Learn the basics of lists in Python. Lists, as their name suggests, are a means for ordering and storing values. : Lists are declared using brackets; for example: t = [1, 2, 3]: Lists may contain a mix of data types; for example: t = ['string', 1, T…
Learn the basics of while and for loops in Python.  while loops are used for testing while, or until, a condition is met: The structure of a while loop is as follows:     while <condition>:         do something         repeate: The break statement m…

763 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

11 Experts available now in Live!

Get 1:1 Help Now