R
robertliucd
Unregistered / Unconfirmed
GUEST, unregistred user!
我想自动提交表单数据,用twebbrowser自动填写表单内容提交可以得到正确的结果,但是用idhttp 的post方法却得不到,我的方法是这样的temp:=TIdMultiPartFormDataStream.Create;
temp.AddFormField('param1','02');
temp.AddFormField(param2,'12345');
idhttp1.post(url,temp)
php的页面源码如下,
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>查询系统</title>
<link rel="stylesheet" type="text/css" href="../style/main.css">
<script language="JavaScript">
<!--
function checkme() {
hphm = document.frm.param1.value;
if(hphm==""{
alert("你必须输入你查询的参数1!"
document.frmVehicle.hphm.focus();
return false;
}
var reMark = /^[A-Za-z0-9]{2}/d{3}$/;
if(!reMark.test(hphm)){
alert("您输入的参数不符合要求!"
document.frm.param1.focus();
return false;
}
document.frm.param1.value = document.frm.param1.value.toUpperCase();
}
//-->
</script>
</head>
<body>
<form action="query.php" method="post" name="frm" onSubmit="return checkme()">
<table width="100%" height="100%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="15"><input name="param1" type="text" id="param1" size="12" value="" /></td>
<td height="40"> <input name="param2" type="text" id="param2" size="12" value="" /></td>
</tr>
</table></td>
</tr>
</table></form>
</body>
</html>
temp.AddFormField('param1','02');
temp.AddFormField(param2,'12345');
idhttp1.post(url,temp)
php的页面源码如下,
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>查询系统</title>
<link rel="stylesheet" type="text/css" href="../style/main.css">
<script language="JavaScript">
<!--
function checkme() {
hphm = document.frm.param1.value;
if(hphm==""{
alert("你必须输入你查询的参数1!"
document.frmVehicle.hphm.focus();
return false;
}
var reMark = /^[A-Za-z0-9]{2}/d{3}$/;
if(!reMark.test(hphm)){
alert("您输入的参数不符合要求!"
document.frm.param1.focus();
return false;
}
document.frm.param1.value = document.frm.param1.value.toUpperCase();
}
//-->
</script>
</head>
<body>
<form action="query.php" method="post" name="frm" onSubmit="return checkme()">
<table width="100%" height="100%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="15"><input name="param1" type="text" id="param1" size="12" value="" /></td>
<td height="40"> <input name="param2" type="text" id="param2" size="12" value="" /></td>
</tr>
</table></td>
</tr>
</table></form>
</body>
</html>