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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...