部分代码:
<form name="status" method="POST" action="">
<input type="text" value="@upchan_id#" name="upchan_id" />
<input type="button" value="Submit" onClick="" />
<input type="text" name="start_req" id="start_req" value="@start_req#" />
<input name="button" type="button" value="Click here to restart you cable modem" onClick="">
</form>
现在我想对value为"@upchan_id#"
value为"@start_req#"
提交上来的信息在.c中分别用函数去处理它们,处理函数如下:
int main(int argc, char** argv)
{
int isPOST = InitPOST();
long postVALUE;
if (isPOST)
{
if (getPOST_LONG("start_req", &postVALUE) == OK)
CheckStartReQBtn();
if(getPOST_LONG("upchan_id", &postVALUE) == OK)
CheckUpstreamChannelID();
FinnPOST();
}
}
问题是无论我点击那个button,它们都只走CheckStartReQBtn();这个函数。请问为什么?
<form name="status" method="POST" action="">
<input type="text" value="@upchan_id#" name="upchan_id" />
<input type="button" value="Submit" onClick="" />
<input type="text" name="start_req" id="start_req" value="@start_req#" />
<input name="button" type="button" value="Click here to restart you cable modem" onClick="">
</form>
现在我想对value为"@upchan_id#"
value为"@start_req#"
提交上来的信息在.c中分别用函数去处理它们,处理函数如下:
int main(int argc, char** argv)
{
int isPOST = InitPOST();
long postVALUE;
if (isPOST)
{
if (getPOST_LONG("start_req", &postVALUE) == OK)
CheckStartReQBtn();
if(getPOST_LONG("upchan_id", &postVALUE) == OK)
CheckUpstreamChannelID();
FinnPOST();
}
}
问题是无论我点击那个button,它们都只走CheckStartReQBtn();这个函数。请问为什么?
每个SUBMIT加个VALUE就能区分了,如 <input type="submit" value="value1"/> 怎么区分?朋友
知道就告诉我吧,呵呵,我在这里有礼了
为什么不用ajax?很容易实现。
我没有用过ajax啊!刚认识JavaScript跟html
这种问题我也遇到过,一个form只能对应一个submit,你可以在一个页面中只做一个submit,把要提交的信息写在一个c函数里面,也可以做多个form,每个form对应一个submit,给form设置不同的名字就可以了
但是你不同的提交内容应该写到不同的form里边,form之间用不同的id来区分