谁帮忙检查下这段简单的代码..?
----------------//DELPHI//------------------------------------
procedure TForm1.Button1Click(Sender: TObject);
var
no1:String;
no2:string;
PostURL :String;
sParams :String;
aParams :TStrings;
aStream :TStringStream;
begin
IdHTTP1 := TIdHTTP.Create(nil);
aParams := TStringList.Create;
aStream := TStringStream.Create('');
form1.Edit4.Clear;//清空结果区
no1:=edit1.Text ;
no2:=edit2.Text ;
PostURL := 'http://localhost/add.asp?no1='no1+; //提交网址
sParams := 'no2='+no2; //参数
try
aParams.Clear;
aParams.Add(sParams);
IdHTTP1.Request.ContentType := 'application/x-www-form-urlencoded';
IdHTTP1.Post(PostURL, aParams, aStream); //提交
form1.Edit4.Text:=astream.DataString;//获取结果
finally
IdHTTP1.Free;
aParams.Free;
aStream.Free;
end;
end;
------------//ASP文件//-----------------------------------------
<%
'code of add.asp
dim no1,no2,isok,msg,jg
no1=trim(request("name"))
no2=trim(request("no2"))
if no1="" then
isok=true
msg="乘数1无效!"
else
isok=false
end if
if no2="" then
isok=true
msg="乘数2无效!"
else
isok=false
end if
if isok=true then
response.write msg
else
jg=no1*no2
response.write jg
end if
%>
出错在:
PostURL := 'http://localhost/add.asp?no1='no1+; //提交网址
sParams := 'no2='+no2; //参数
怎么写,才能使POST有效?
[解决办法]
"http://localhost/add.asp?no1= "no1+;
用单引号
''