title: Posting Form Data With idHTTP in Delphi
body: <p>I'm using Delphi with IdHTTP lib to get a form from this URL (<a href="http://apply.dataprocessors.com.au" rel="nofollow">http://apply.dataprocessors.com.au</a>), handle the puzzle and post with the correct answer. But, apparently I am not handling the method POST properly, once the response retrieved is: "Problem with submission. Please try again."</p>
  
  <p>Below is the Delphi source code:</p>
  
  <pre><code>procedure TForm1.Button1Click(Sender: TObject);
  var
    sGET, sPOST, sGET_count: String;
    countCircles: integer;
    parameters: TStringList;
  begin
    parameters := TStringList.Create;
    sGET := http.Get('http://apply.dataprocessors.com.au');
    sGET_count := StringReplace(sGET, '$', ' ', [rfReplaceAll, rfIgnoreCase]);
    sGET_count := StringReplace(sGET_count, 'unfilled', '$', [rfReplaceAll, rfIgnoreCase]);
    countCircles := 120 - sGET_count.CountChar('$');
  
    parameters.Add('title=submit');
    parameters.Add('value=' + countCircles.ToString());
    parameters.Add('submit=Submit');
    http.Request.ContentType := 'application/x-www-form-urlencoded';
    sPOST := http.Post('http://apply.dataprocessors.com.au/?', parameters);
    txtPost.Lines.Add(sPOST);
  end; 
  </code></pre>
  
  <p><a href="http://i.stack.imgur.com/8X4xa.png" rel="nofollow">Form retrieved</a></p>
  
  <p>HTML code:</p>
  
  <pre><code>&lt;html&gt;
    &lt;head&gt;
    &lt;/head&gt;
  &lt;body&gt;
  &lt;form action="" method="POST"&gt;
        &lt;input type="hidden" name="title" value="submit"&gt;
        &lt;p&gt;How many filled circles do you see:? &lt;br&gt;&lt;img src="unfilled_O.gif" height="12" width="12"&gt;&lt;br&gt;&lt;/p&gt;
        &lt;p&gt;Answer: &lt;input type="text" name="value" value="" size="10"&gt;&lt;/p&gt;
        &lt;p&gt;&lt;input type="Submit" value="Submit"&gt;
  &lt;/form&gt;&lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Response retrieved from POST method:</p>
  
  <pre><code>&lt;html&gt;
    &lt;head&gt;
    &lt;/head&gt;
    &lt;body&gt;
    &lt;p&gt;Problem with submission. Please try again.&lt;/p&gt;&lt;/body&gt;
  &lt;/html&gt;
  </code></pre>