title: Sending multiple input values with PHP and WordPress
body: <p>OK, so here is my slightly complicated question for you guys.</p>
  
  <p>I have a WordPress site where user can add products to category, there is functionality which displays sorted products in one page. Here is pretty much code of single product:</p>
  
  <pre><code>&lt;td&gt;&lt;input class="cbx" type="checkbox" name="product" value="product"&gt;    &lt;/td&gt;
  &lt;td class="bright"&gt;&lt;?php the_title(); ?&gt; &lt;input class="ptitle" type="hidden" name="ptitle" value="&lt;?php the_title(); ?&gt;"&gt;&lt;/td&gt;
              &lt;td class="bright"&gt;box&lt;/td&gt;
              &lt;td class="bright"&gt;height&lt;/td&gt;
              &lt;td class="bright"&gt;price&lt;/td&gt;
              &lt;td&gt; &lt;input class="count" type="text" name="&lt;?php echo $post-&gt;ID; ?&gt;count" maxlength="4"&gt;&lt;/td&gt;
  &lt;/tr&gt;
  </code></pre>
  
  <p>This code is looped and displays in form tags on other archive.php . On archive.php i have jquery script which sends data from form to mail.php pasted below (i stripped it a bit for better visibility):</p>
  
  <pre><code>    &lt;?php
  // Fetching Values from URL.
  $email = $_POST['email'];
  $place = $_POST['place'] ;
  $street = $_POST['street'] ;
  $code = $_POST['code'] ;
  $email = filter_var($email, FILTER_SANITIZE_EMAIL); 
  if (filter_var($email, FILTER_VALIDATE_EMAIL)) {
  $subject = 'new message';
  $headers = 'MIME-Version: 1.0' . "\r\n";
  $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
  $headers .= 'From:' . $email. "\r\n";
  $template = '&lt;div&gt;&lt;br&gt;&lt;b&gt;Adress:&lt;/b&gt;&lt;br&gt; '.$street.'&lt;br&gt;'. $code.'     '.$place.'&lt;br&gt;'. '&lt;br&gt;&lt;b&gt;Email:&lt;/b&gt; ' . $email . '&lt;br&gt;'
  $sendmessage = "&lt;div&gt;" . $template . "&lt;/div&gt;";
  $sendmessage = wordwrap($sendmessage, 70);
  mail("test@test.com", $subject, $sendmessage, $headers);
  echo "success.";
  } else {
  echo "&lt;span&gt;*incorrect email*&lt;/span&gt;";
  }
  </code></pre>
  
  <p>What i need is a function which will check if product is checked, get its name, gets number which is provided through input and sends it through my email function. </p>
  
  <p>I have no problem sending predefined inputs, but when i get some dynamic data (there are multiple products), i don't know how to handle this. All i have in mind is creating array and foreach loop.</p>
  
  <p>I will appreciate any tips how to deal with this :)</p>