DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/index.php)
-   Shell Scripting (http://www.daniweb.com/forums/forum113.html)
-   -   BMI calculator? (http://www.daniweb.com/forums/thread198639.html)

kaleidoscope Jun 20th, 2009 1:33 am
BMI calculator?
 
Hey,

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. :(

rcollins Jun 20th, 2009 3:13 am
Re: BMI calculator?
 
Try these links to start.
http://www.tizag.com/htmlT/forms.php
http://hoohoo.ncsa.illinois.edu/cgi/primer.html

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

kaleidoscope Jun 20th, 2009 3:37 am
Re: BMI calculator?
 
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!

msvinaykumar Jun 20th, 2009 2:28 pm
Re: BMI calculator?
 
hiyya,

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)

msvinaykumar Jun 20th, 2009 2:30 pm
Re: BMI calculator?
 
And also to start ur CGI script
just press SUBMIT button in html from


All times are GMT -4. The time now is 10:30 pm.

Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC