[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

getting data

Posted on 1998-01-31
9
Medium Priority
?
188 Views
Last Modified: 2013-12-25
im not sure that CGI is the right solution. what i wanna do is to put a form to my web-site where the user can fill in data like eMail and some information about himself. But i have no idea how that is done.
0
Comment
Question by:omsec
[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
  • 5
  • 4
9 Comments
 
LVL 32

Accepted Solution

by:
jhance earned 300 total points
ID: 1831889
Yes, CGI is one way to do this.  It's also the most common way.  If you make a form that looks like this:

<form action="http://myserver.company.com/cgi-bin/cgi-program" method=GET>
<input type=text name=test>
<input type=submit name=submit value=submit>
</form>

When you click the submit button, the browser will send a command back to the server which looks like:

http://myserver.company.com/cgi-bin/cgi-program?test=Some+text+here

When this gets back to your server, it will run the program cgi-program and set the environment string QUERY_STRING to the value text=Some+text+here.  In C you can get this with the getenv() function (other languages will vary).  You need to respond back to the client browser.  A minimal response would be:

printf("Content-type: text/html\n\n");
printf("<HTML>\n");
printf("Thanks...\n");
printf("</HTML>\n");
0
 
LVL 2

Author Comment

by:omsec
ID: 1831890
you mean, this is kinda a "link" to a sub-program ? I havent really experience in C/C++, but i know the GetEnv - Function from Pascal and i know what it does. So how will i need to write that program that should store the data ?

0
 
LVL 32

Expert Comment

by:jhance
ID: 1831891
You need to write a program to read and/or store the data that comes back from a form.  Depending on your server environment, you might do that in PERL, C, C++, unix shell, Java, even Pascal.
0
On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

 
LVL 32

Expert Comment

by:jhance
ID: 1831892
By the way, it's not a link to a subprogram.  The web server actually invokes your cgi-bin program.  It sets some environment variables (like QUERY_STRING) and also attaches your program's output stream, through itself, back to the client web browser.  Your cgi-bin program must send a valid response back to the browser or the whole thing will just sit there.

Here is an example cgi-bin script written in unix bourne shell.  It just receives the cgi-bin request and echos out most (if not all) of the environment variable information:

#!/bin/sh

echo Content-type: text/plain
echo

echo CGI/1.0 test script report:
echo

echo argc is $#. argv is "$*".
echo

echo SERVER_SOFTWARE = $SERVER_SOFTWARE
echo SERVER_NAME = $SERVER_NAME
echo GATEWAY_INTERFACE = $GATEWAY_INTERFACE
echo SERVER_PROTOCOL = $SERVER_PROTOCOL
echo SERVER_PORT = $SERVER_PORT
echo REQUEST_METHOD = $REQUEST_METHOD
echo HTTP_ACCEPT = "$HTTP_ACCEPT"
echo PATH_INFO = "$PATH_INFO"
echo PATH_TRANSLATED = "$PATH_TRANSLATED"
echo SCRIPT_NAME = "$SCRIPT_NAME"
echo QUERY_STRING = "$QUERY_STRING"
echo REMOTE_HOST = $REMOTE_HOST
echo REMOTE_ADDR = $REMOTE_ADDR
echo REMOTE_USER = $REMOTE_USER
echo AUTH_TYPE = $AUTH_TYPE
echo CONTENT_TYPE = $CONTENT_TYPE
echo CONTENT_LENGTH = $CONTENT_LENGTH
0
 
LVL 2

Author Comment

by:omsec
ID: 1831893
i dont have an unix compiler. only an old crappy C/C++ borlad c 3.1
0
 
LVL 32

Expert Comment

by:jhance
ID: 1831894
Like I said, what language you use depends on the web server you are using.  What is your web server environment?
0
 
LVL 2

Author Comment

by:omsec
ID: 1831895
oh, emm.. unix

www.centralnet.ch its at my ISPs server
0
 
LVL 32

Expert Comment

by:jhance
ID: 1831896
then you should be able to use any language that is supported on that server.  The above example is in Bourne Shell and doesn't even need to be compiled.
0
 
LVL 2

Author Comment

by:omsec
ID: 1831897
ok, thanx and by the yer very fast :)
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

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…
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…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
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…
Suggested Courses

656 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