tags:

views:

123

answers:

1

I'm coding following CGI script

echo "Content-type: text/html; charset=UTF-8\n\n"
echo "<HTML><HEAD><TITLE>title</TITLE></HEAD>"
echo "<BODY>"
echo "<FORM ACTION="http://exapmle.com/page2.cgi" NAME="PAGE1" METHOD="POST">"
echo "input:<INPUT TYPE=text NAME="data1" SIZE=10 MAXLENGTH=10>"
echo "<INPUT TYPE=submit NAME=nbtn VALUE='GO TO PAGE2'>"
echo "</FORM>"
echo "</BODY>"
echo "</HTML>"

How to get valiable in CGI made by /bin/sh + Apache I am glad gime me sample cord

+2  A: 

In the CGI script, you receive it as a parameter to main, so it should be in some place pointed by argv

Apache runs the cgi just like you:

script.cgi var1

And the parameters are in argv, so this:

printf("%s", argv[1]);

Will output

var1
slipbull