Click to See Complete Forum and Search --> : Basic CGI call syntax


dsullinger
08-05-2003, 12:03 PM
Could someone give me the basic syntax needed to make a simple CGI call? All my page has in it is a text input and submit button and the action call.

The problem is when I place data in the text field and submit it, the cgi is being called, but the data is not being passed to it.

Here's the actual code:

<form METHOD=POST ACTION="some-cgi-script.sh">
<p><input type="text" name="T1" size="20"><input type="submit" value="Submit" name="B1"><input type="reset" value="Reset" name="B2"></p>


What am I missing here?

Thanks for any help

goofball
08-05-2003, 12:10 PM
From your form, it looks like the data is indeed being sent.
The problem is probably in the CGI script. You just have to access & handle that bit of data from the script.

If I was using Perl for this ...

use CGI ':standard';
$text = param('T1');


once you have that data in the variable $text, you can do whatever you want with it.

dsullinger
08-05-2003, 03:08 PM
Yes, you are correct... I see that now. My address field in my browser says "http://server-name/cgi-bin/nph-Ping.sh?T1=10.0.0.1"

The UNIX script I have is simply echoing the results with:

ping -sn "$QUERY_STRING"

I guess I could simply use awk and strip out the characters after the "=" sign.

Thanks!