title: PHP cURL Form data: Multiple variables, same name, diff. values
body: <p>I am working with PHP cUrl to query a form. It does a POST query, so I am using an associative array. This is what the form looks like:</p>
  
  <pre><code>&lt;form action="form.php" method="POST"&gt;
  ...
      &lt;input type="hidden" name="var" value="value1"&gt;
      &lt;input type="hidden" name="var" value="value2"&gt;
      &lt;input type="hidden" name="var" value="value3"&gt;
      &lt;input type="hidden" name="var" value="value4"&gt;
      &lt;input type="hidden" name="var" value="value5"&gt;
  ...
  &lt;/form&gt;
  </code></pre>
  
  <p>While doing my cUrl query, I have the following code:</p>
  
  <pre><code>$postfields = array();
  $postfields ["var"] = "value1";
  $postfields ["var"] = "value2";
  $postfields ["var"] = "value3";
  $postfields ["var"] = "value4";
  $postfields ["var"] = "value5";
  
  $ch = curl_init();
  curl_setopt($ch, CURLOPT_URL,$url);
  curl_setopt($ch, CURLOPT_POST, true);
  curl_setopt($ch, CURLOPT_POSTFIELDS, $postfields);
  curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_6; en-US) AppleWebKit/534.16 (KHTML, like Gecko) Chrome/10.0.648.204 Safari/534.16");
  curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  curl_setopt($ch, CURLOPT_COOKIEFILE, "cookie.txt");
  curl_setopt($ch, CURLOPT_COOKIEJAR, "cookie.txt");
  curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
  curl_setopt($ch, CURLOPT_REFERER, $referer);
  $result = curl_exec ($ch);
  curl_close ($ch); 
  </code></pre>
  
  <p>Obviously in this case, PHP overwrites the previous 4 "var" assignments and only value5 gets passed as a parameter and I get an error saying I am missing value1..value4.  I tried making "var" an array but that also prompts me an error.</p>
  
  <p>Am I overlooking something?
  Thanks</p>