procedure TForm1.SubmitPostForm;
var
strPostData: string;
Data: Pointer;
URL, Flags, TargetFrameName, PostData, Headers: OleVariant;
begin
{
<form method="post" action="http://127.0.0.1/cgi-bin/register.pl">
<input type="text" name="FIRSTNAME" value="Hans">
<input type="text" name="LASTNAME" value="Gulo">
<input type="text" name="NOTE" value="thats it">
<input type="submit">
</form>
}
strPostData := 'FIRSTNAME=Hans&LASTNAME=Gulo&NOTE=thats+it';
PostData := VarArrayCreate([0, Length(strPostData) - 1], varByte);
Data := VarArrayLock(PostData);
try
Move(strPostData[1], Data^, Length(strPostData));
finally
VarArrayUnlock(PostData);
end;
URL := 'http://127.0.0.1/cgi-bin/register.pl';
Flags := EmptyParam;
TargetFrameName := EmptyParam;
Headers := EmptyParam; // TWebBrowser will see that we are providing
// post data and then should automatically fill
// this Headers with appropriate value
WebBrowser1.Navigate2(
URL, Flags, TargetFrameName, PostData, Headers);
end;