/第九页/
<!doctype html>
<input type="hidden"name="mode1"value="user"/>
<input type="hidden"name="fun"value="login"/>
用户名: <input type=“text” name="username"placehodler=“请输入用户名”/ >
密码: <input type="password"nam="pwd"placehodler=“请输入密码”/>
<input name="sex"type="radio"value=“1”> 男
<input name="sex"type="radio"value=“2”> 女
描述: <textarea name="desc cols="50"rows=“30”>
民族:
临沂 北京 河南
第二部分
char username[256];
char pwd[250];
char desc[256];
char sex[3];
char quyu[256];
if(cgiFormSubmitClicked(“login”) == cgiFormSuccess){
cgiFormString(“username”,username,sizeof(username));
cgiFormString(“pwd”,pwd,sizeof(pwd));
cgiFormString(“sex”,sex,sizeof(sex));
cgiFormString(“desc”,desc,sizeof(desc));
cgiFormString(“quyu”,quyu,sizeof(quyu));
cgiHeaderContentType("text/html;charset=“gbk”);
//printf(username);
//printf(pwd);
fprintf(cgiOut,"");
fprintf(cgiOut,“用户名:%s,性别:%s”,username,quyu);
fprintf(cgiOut,"");
return 0;
}
第十页前半部分
#include<stdio.h>
#include<stdlib,h>
#include<string.h>
#include<cgic.h>
int cgiMain(){
char mode1[32] = {0};//那个模块进来的
char fun[32] = {0};
if(cgiFormString(“mode1”,mode1,sizeof(mode1))!=cgiFormSuccess){
cgiHeaderContentType(“text/html;charset=gbk”);
printf(“mode1参数必传”);
return0;
}
}
if(cgiFormString(“fun”,fun.sizeof(fun))!=cgiFormSuccess){
cgiHeaderContentType(“text/html;charset=gbk”);
printf(“fun参数必传”);
return 0;
}
后半部分
if(strcmp(mode1,“user”)==0)
{
if(strcmp(fun,“toLogin”)==0)
{
cgiHeaderLocation(“login.html”);
}
else if(strcmp(fun,“toRegister”)==0){
cgiHeaderLocation(“register.html”);
}
else if(strcmp(fun,“login”)==0){
char username[256];
char pwd[250];
cgiFormString(“username”,username,sizeof(username));
cgiFormString(“pwd”,pwd,sizeof(pwd));
if(strcmp(username,“zq”)==0&&strcmp(pwd),“123”)==0{
printf(“登陆成功”);
return 0;
}
else{
cgiHeaderContentType(“text/html;charset=gbk”);
printf(“用户名或密码错误”);
return0;
}
}
}
11
<!doctype@ html>
列表
<ul>
<TMPL-LOOP name = "goods">
<li>商品名称; <TMPL-VAR name ="goodname">; 价格:<TMPL-VAR name ="price"></li>
12 #include