ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
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.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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
Well! I am finally done! Sorry, I didn't think it would take that long! I had to write documentation for using my library. It is included in the archive. You can download that here:
I hope you, and who ever else uses this library enjoys it.
You may use my code however you see fit. However I am not responsible in anyway for any damage caused by my code in any shape or form.
Oh! Also, if/when you are done with your CGI script(s) (who ever uses my library) I would appreciate it if you e-mailed me with the link, so I can go see it! Thanks! Enjoy!
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
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.