title: Using TIdHTTP in Delphi to submit form and retrive data (not the usual)
body: <p>There exists a web page (www.someurl.co.uk) that, amongst other stuff, has inside it a form containing an input field and an image. </p>
  
  <p>In a browser, when the user enters a string in the input field and clicks the image, the form is submitted and another page is generated (www.someurl.co.uk/results.php) containing, amongst other things, a table containing some results.</p>
  
  <p>I need Delphi to fill in the string in the form on the first page, submit the form and get back the contents of a couple of cells from the table on the results page.</p>
  
  <p>I have used the TIdHTTP component to post data to the form using the code below but the text I see in the memo box afterwards is simply the html of the initial page (www.someurl.co.uk).</p>
  
  <p>Please can somebody help me with the correct code to get the the values BlaBla_A, BlaBla_C, BlaBla_C and BlaBla_D from the results page - and to know which is which?</p>
  
  <p>(Although I'm happy with Delphi, I don't know much about web pages and HTML and this is my first time using the Indy component) </p>
  
  <p><strong>This is the code I am using at the moment</strong></p>
  
  <pre><code>procedure TForm1.Button2Click(Sender: TObject);
  var
    Response: TStringStream;
    Params: TStringList;
  begin
  Params := TStringList.Create;
  try
    Params.Add('thedata=' + 'MyString');
    Response := TStringStream.Create('');
    try
       IdHTTP1.Post('www.someurl.co.uk', Params, Response);
       memo1.Text := Response.DataString;
    except
     on E: Exception do
     begin
      showmessage('Error: ' + E.Message);
     end;
    end;
  
  finally
    Params.Free;
    Response.Free;
  end;
  
  end;
  </code></pre>
  
  <p><strong>The important bit of the data entry/submit page (www.someurl.co.uk) looks like this</strong></p>
  
  <pre><code>&lt;/div&gt;
  &lt;h3&gt;Enter the data you want to look for then click FIND&lt;/h3&gt;
  &lt;form action="results.php" method="post" name="form1" target="_parent" 
        id="form1" 
        onsubmit="if (document.getElementById('text').value==''  
                     || document.getElementById('text').value=='ENTER DATA') 
                     {alert ('Please enter data first then click FIND'); 
                     return false;} 
              else 
                 return true;"&gt;
  
  &lt;input name="thedata" type="text" id="text" value="ENTER DATA" 
         onclick="effectClear(this.id);this.value = '';" 
         class="validate[required]"/&gt;
  
  &lt;input type="image" src="../images/find.png" name="image" id="homebutton" /&gt;
  &lt;/form&gt;
  &lt;/div&gt;  
  </code></pre>
  
  <p><strong>and the important bit of the results page  (www.someurl.co.uk/results.php) looks like this</strong></p>
  
  <pre><code>&lt;div id="results_details"&gt;
      &lt;table id="results_details_table" border="0"&gt;
          &lt;tr&gt;
            &lt;td class="result_general"&gt;&lt;h2&gt;Here are your results&lt;/h2&gt;&lt;br/&gt;&lt;/td&gt;
            &lt;td class="result_info"&gt;
                &lt;label&gt;Result_A&lt;/label&gt;&lt;br/&gt;BlaBla_A&lt;br/&gt;
                &lt;label&gt;Result_B&lt;/label&gt;&lt;br/&gt;BlaBla_B&lt;br/&gt;
            &lt;/td&gt;
            &lt;td class="result_info"&gt;
                &lt;label&gt;Result_C&lt;/label&gt;&lt;br/&gt;BlaBla_C&lt;br/&gt;&lt;br/&gt;
                &lt;label&gt;Result_D&lt;/label&gt;&lt;br/&gt;BlaBla_D&lt;br/&gt;&lt;br/&gt;
            &lt;/td&gt;
          &lt;/tr&gt;
          &lt;/table&gt;
  &lt;/div&gt;
  </code></pre>