title: connect a php $post_data[ with html code
body: <p>I have the following code:</p>
  
  <pre><code>&lt;?php
  $post_data['firstname'] = '';
  $post_data['lastname'] = '';
  $post_data['address'] = '';
  
  
  foreach ( $post_data as $key =&gt; $value)
  {
  $post_items[] = $key . '=' . $value;
  }
  
  $post_string = implode ('&amp;', $post_items);
  $curl_connection = curl_init('https://example.com/app.php');
  curl_setopt($curl_connection, CURLOPT_CONNECTTIMEOUT, 30);
  curl_setopt($curl_connection, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)");
  curl_setopt($curl_connection, CURLOPT_RETURNTRANSFER, true);
  curl_setopt($curl_connection, CURLOPT_SSL_VERIFYPEER, false);
  curl_setopt($curl_connection, CURLOPT_FOLLOWLOCATION, 1);
  curl_setopt($curl_connection, CURLOPT_POSTFIELDS, $post_string);
  $result = curl_exec($curl_connection);
  echo "Result: " . $result . "&lt;br&gt;&lt;br&gt;";
  print_r(curl_getinfo($curl_connection));
  echo curl_errno($curl_connection) . '-' . curl_error($curl_connection);
  curl_close($curl_connection);
  ?&gt;
  </code></pre>
  
  <p>How do I connect it to an HTML form so that someone can enter their details in an HTML page and its value will be redirected to this PHP code?</p>
  
  <p>my HTML code is:</p>
  
  <pre><code>&lt;form name="form" method="post" action="my_php.php"&gt;
  &lt;input name="firstname" type="text" ID="firstname" value="first name"&gt;
  &lt;input name="lastname" type="text" ID="lastname" value="last name"&gt;
  &lt;input name="address" type="text" ID="address" value="address"&gt;
  &lt;input type="submit" name="Submit" value="Submit"&gt;
  </code></pre>