title: PHP $post and forms
body: <p>I have a form that has two field inputs that also have the same name "name"</p>
  
  <p>I was wondering what do I have to do , to capture both fields in array,</p>
  
  <p>for example,  if field1 get post and field2 was empty, I would like to get an array[0]
  with the data I was looking for and if field1 and field2 where submited, I would like to have array[0] and array[1] populated.</p>
  
  <p>currently the form I have will only capture if both fields are populated and if one of them is populated it wonn't capture .</p>
  
  <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
  &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
  &lt;head&gt;
  &lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /&gt;
  &lt;title&gt;Untitled Document&lt;/title&gt;
  
  
  &lt;?php 
  
  $name=$_POST['name'];
  
  
  if($name)
  {
  
      echo $name;
  
      }
  
  
  ?&gt;
  
  
  &lt;/head&gt;
  
  &lt;body&gt;
  
  
  &lt;form action="&lt;?php $_SERVER['PHP_SELF']?&gt;" method="post"&gt;
  
    &lt;p&gt;name
    &lt;input name="name" id="name" type="text" /&gt;
  
  
  
    &lt;/p&gt;
    Name
  
    &lt;input name="name"  id="name" type="text" /&gt;
    &lt;p&gt;&amp;nbsp;&lt;/p&gt;
  
  
    &lt;input name="submit" type="submit" /&gt;
  &lt;/form&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>I would like the end results for the variable name to be an array that would have both data that was capture from field one and field two.</p>
  
  <p>thanks</p>