Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Getting FORM variables

Posted on 1999-07-23
4
Medium Priority
?
155 Views
Last Modified: 2013-12-25
Does anybody know how I can get the variables from a FORM to my C program. The server used is an Apache server under UNIX.
0
Comment
Question by:Michel021497
[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
4 Comments
 
LVL 1

Expert Comment

by:BillyAbbott
ID: 1835167
http://www.hut.fi/~jkorpela/forms/cgic.html

have a look at the 'How to process a simple form' and 'How to process a form with METHOD="POST"' sections...
0
 
LVL 10

Expert Comment

by:MasseyM
ID: 1835168
Does your C Program accept parameters?
Also, how big is your form?

0
 
LVL 8

Accepted Solution

by:
jhurst earned 400 total points
ID: 1835169
void main(void)
  {
  char str[800];
  if (getenv("QUERY_STRING"))
    strcpy(str,getenv("QUERY_STRING");
  else
    strcpy(str,"No Get Parameters");
  printf("Content-type: text/html\n\n");
  printf("<html><body>Parameters from Get are: %s\n",str);
  printf("</body></html>\n");
  exit;
  }

If the form does a post, then they are available with fgets() or whatever else from stdin.

The environment variable, REQUEST_METHOD will be set to GET or POST as appropriate.

   
  }
0
 
LVL 1

Expert Comment

by:Moondancer
ID: 6872594
GREETINGS!

This question was awarded, but never cleared due to the JSP-500 errors of that time.  It was "stuck" against userID -1 versus the intended expert whom you awarded.  This corrects the problem and the expert will now receive these points; points verified.

Please click on your Member Profile and select "View Question History" to navigate through any open or locked questions you may have to update and finalize them.  If you are an EE Pro user, you can also choose Power Search to find all your open questions.

This is the Community Support link, if help is needed, along with the link to All Topics which reflects many TAs recently added.

http://www.experts-exchange.com/jsp/qList.jsp?ta=commspt
http://www.experts-exchange.com/jsp/zonesAll.jsp
 
Thank you,
Moondancer
Moderator @ Experts Exchange
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

If you get a (Blue Screen of Death), your system writes a small file called a minidump. Your first step is to make certain your computer is setup to record memory dumps. Right click My Computer, choose properties. Click on the advanced tab, an…
Making a simple AJAX shopping cart Couple years ago I made my first shopping cart, I used iframe and JavaScript, it was very good at that time, there were no sessions or AJAX, I used cookies on clients machine. Today we have more advanced techno…
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…
The viewer will learn how to dynamically set the form action using jQuery.

671 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