C program:
#include
#include
int main()
{
char *data = getenv("QUERY_STRING");
char userName[30];
sscanf(data,"uname=%s", userName);
printf ("Content-Type: text/html\n\n");
printf ("");
printf ("
");printf ("
");printf ("
%s
", userName);printf (" ");
return 0;
}
HTML:
Please enter your name:
I am trying to use the C program to make a simple html page that just displays the variable uname with GET from html. I am trying to do this by first compiling C to CGI with:
gcc echo.c -o echo.cgi
which it does fine. However, whenever I press submit the cgi file just starts to download. What am I doing wrong