I wanted to create a Body Mass Index calculator. I've already created a seperate HTML file with a form where you have to type in your weight and height. So far so good, now I want to 'transfer' the data to my cgi script (unix shell script) as soon as I hit the 'Submit' button. But I have no idea how to start the cgi script. So it like copies the data from the form into the script where I can calculate the body mass index in the end.

I tried a lot of things already but nothing worked so far. :( So I was wondering if anyone could give me a tip or something? I already checked the entire world wide web (or so it seemed xD) but I didn't really find anything.

Sorry if this is not allowed here, but I didn't know where else to ask. :(

Recommended Answers

Try these links to start.

You start your application by placing it's path in the action attribute of the form tag.

Jump to Post

All 4 Replies

Thank you for the links.
So I have my HTML file now with the form (+ form tag where I placed the url to the cgi script). I read through the 2nd link and it says that the most important command is the "Query_String" command.

So, how do I start my cgi script now? I know that I have to say "#!/bin/bash .... content-type: text/html" and so on but I don't really know where to place the Query_String or what to do with it?! Do I start with "read QUERY_STRING" and then "echo QUERY_STRING" for example?

Sorry for being such a noob. I know what I wanna do but I don't know how to do it exactly :/

Thanks for your help though!


Before doing all this stuff.

First step is to do is

a) Configure apache Server (Find in google how to do)
b) Run few sample example which is bultin in apache server
just to confirm whether apache is properly configured
c) Use FORM tag in html to run CGI script. There are quite good number of examples available on net ( Let me know if u are not able
to get this)

And also to start ur CGI script
just press SUBMIT button in html from

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.