Jump to content

How to send a form via post method to a external URL


KingOrmon

Recommended Posts

This can not be done with unigui. You need use Indy, or another http/sockets library

 

 

procedure TForm1.Button1Click(Sender: TObject);
var
 http: TIdHttp;
 params: TStrings;
 Response: string;
begin
 http := TIdHTTP.Create(Self);
 params := TStringList.Create;
 try
   params.Add('var1=value1');
   params.Add('var1=value2');
   Response := http.Post('http://dec.clubdelphi.com/temporales/pruebas-post.php', params);
   ShowMessage('Response: ' + Response);
 finally
   http.Free;
   params.Free;
 end;
end;

Link to comment
Share on other sites

I am trying to form code via AddJS:

 

<form id=compra name=compra action="URLK" method=post>
<input type=hidden name=Merc value="TPV">
...
</form>

 

Then I try to call form submit:

 

function OnClick(sender, e)
{
 window.document.forms["compra"].submit();
}

 

 

But it does not work.

 

Regards

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...