ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
I have never programmed cgi scripts before, but I have done shell scripting and c++, and c programming.
My question is this. I want to creat a check box form( in html or cgi)
then hit submit and it will take me to a server hosted on a NETdimm.
so if I hit yes on the check box it will take me to the cgi script and in there the script will execute a c program that will run a function on the board.
I need to use cgi as its the only thing that will interface with my uclinux boa web server.
I am a little confused as to how to go about setting this up,
can I create the form entirely with html and then when I hit submit it will take me to the /cgi-bin/myprogram.cgi..... or can I do the entire web page in the cgi script. I am confused as to how this works.
how to test( dont have the boa web server setup yet)
some good links to cgi tutorials, and sample scripts(only in shell scripting/ perl not supported)
All cgi is, is a program (written in any language) that prints html tags to stdout and receives input through enviroment variables. I have a CGI library that I wrote (it's C++) that makes writing CGI scripts REALLY easy.
I will e-mail it to you, or post a link here (so, just incase any body else want to use it they can). But as I always say: I am not responsible in any way for any damage caused by any of my code, though you may use it as you wish (unless I specify otherwise). I will post the link as soon as posible.
THe trick is to set up the form in HTML, Then input from the form will be recieved by the program through env vars and you output to stdout which will be recieved by the browser as an HTML document or redirection.
To set the form to execute the cgi when the user hits submit is part of the form tag. i.e
Hey, thankyou, that helps alot. ( I havent read the documentation yet)
I have a few other questions, How can I test the cgi on my own computer...that is how do I set up a server on one computer to test the scripts and html, either in windows or linux( I work with both alot) can I use httpd in linux ? what about windows
also: I went to some other sites with cgi tutorials and they list environment variables : $query string etc...... they were like this:
now do I have to type or code all of these variables?
they also described how to test it i think. For myself i wrote some small shell commandos in a script and tested it. Oh yeah, for input from html forms to cgi i used proccgi.sh (you find it on google or other search machines).
I got it working in no time
Well I have RedHat 9.0, and it comes installed with Apache. So all I have to do is compile my cgi script, and copy it to /var/www/cgi-bin, then (after starting Apache... wich is done like this: "httpd" as super user) I open my fav' browser, and type: http://127.0.0.1/cgi-bin/myscript.cgi