我要做的是,在html表单提交上,在服务器上创建配置文件,并使用配置文件数据更新html表单字段。现在我能够创建配置文件。任何人都可以帮我使用表单字段部分吗?我需要用html和c来做。 `
int main(void)
{
char *lenstr;
char input[MAXINPUT], data[MAXINPUT];
long len;
printf("%s%c%c\n",
"Content-Type:text/html;charset=iso-8859-1",13,10);
printf("<TITLE>Response</TITLE>\n");
lenstr = getenv("CONTENT_LENGTH");
if(lenstr == NULL || sscanf(lenstr,"%ld",&len)!=1 || len > MAXLEN)
{
printf("<P>Error in invocation - wrong FORM probably.");
}
else
{
FILE *f;
fgets(input, len+1, stdin);
unencode(input+EXTRA, input+len, data);
f = fopen(DATAFILE, "w+");
if(f == NULL)
{
printf("<P>Sorry, cannot store your data.");
}
else
{
fputs(data, f);
}
fclose(f);
printf("<P>Thank you! The following contribution of yours has \
been saved:<BR>%s",data);
}
return 0;
}
`