title: How to submit multiple array checkbox with html forms
body: <p>I am trying to submit multiple arrays with a checkbox form but I am only able to submit one array at the moment, here is what I have so far</p>
  
  <p>In this example I am submitting an array of numbers with the <code>delete[]</code> array, this array gets processed properly, I also want to submit the array <code>condition[]</code> this does not get processed properly, what is the best way to solve this issue?</p>
  
  <p><strong>php code</strong></p>
  
  <pre><code>$catalog = $database-&gt;getInventory();
  
  if($catalog){   
     $numRows = sizeof($catalog);//count
     echo "&lt;b&gt;Book Count:&lt;/b&gt; ".$numRows."&lt;br&gt;";
  
     echo "&lt;form method='post' action='inventory.php'&gt;";
     echo "&lt;table id='example' class='tablesorter' border='0' cellpadding='0' cellspacing='1'&gt;";
     echo "
        &lt;thead&gt;
           &lt;tr&gt;
             &lt;th&gt;ISBN&lt;/th&gt;        
             &lt;th&gt;Title&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/th&gt;
             &lt;th&gt;Rank&amp;nbsp;&amp;nbsp;&lt;/th&gt;
             &lt;th&gt;Condition&amp;nbsp;&amp;nbsp;&lt;/th&gt;   
             &lt;th&gt;&lt;input type='checkbox' name='delete' value='all' /&gt;&lt;/th&gt;
           &lt;/tr&gt;
        &lt;/thead&gt;\n";
  
  
     foreach($catalog as $elem){
        echo "
           &lt;tr&gt;
              &lt;td&gt;".$elem["isbn"]."&lt;/td&gt;
              &lt;td&gt;".$elem["title"]."&lt;/td&gt;
              &lt;td&gt;".$elem["rank"]."&lt;/td&gt;
              &lt;td&gt;".$elem["condition"]."&lt;/td&gt;
              &lt;td&gt; 
                 &lt;input type='checkbox' name='add[]' 
                    value='".$elem['isbn']."_".$elem['condition']."_"."' /&gt;
              &lt;/td&gt;
           &lt;/tr&gt;";    
     }
  
     echo "&lt;/table&gt;";
     echo "&lt;/form&gt;";
  }
  </code></pre>
  
  <p><strong>example html markup</strong></p>
  
  <pre><code>&lt;form method='post' action='inventory.php'&gt;
     &lt;table&gt;
        &lt;tr&gt;
           &lt;td&gt;
              &lt;input type='hidden' name='addInventoryBook' value='1'&gt;
              &lt;input type='submit' value='Add' /&gt;
           &lt;/td&gt;
        &lt;/tr&gt;
  
        &lt;tr&gt;
           &lt;td&gt;
              &lt;input type='checkbox' name='add[]' value='100001_used' /&gt;
           &lt;/td&gt;
        &lt;/tr&gt;
  
        &lt;tr&gt;
           &lt;td&gt;
              &lt;input type='checkbox' name='add[]' value='100001_new' /&gt;
           &lt;/td&gt;
        &lt;/tr&gt;
  
        &lt;tr&gt;
           &lt;td&gt;
              &lt;input type='checkbox' name='add[]' value='100003_new' /&gt;
           &lt;/td&gt;
        &lt;/tr&gt;
  
     &lt;/table&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p><strong>php function</strong></p>
  
  <pre><code>function Inventory(){   
     if(isset($_POST['addInventoryBook'])){
        if(isset($_POST['add']) &amp;&amp; is_array($_POST['add'])){
       $arr = array();
           foreach($_POST['add'] as $checkbox){
              $temp = explode("_", $checkbox);
  
              $arr[] = array(
                 "isbn"       =&gt; $temp[0],
                 "condition"      =&gt; $temp[1],
                 "sub_condition"  =&gt; $temp[2]
              );
           }              
       $this-&gt;addInventoryBook($arr); 
        }
  
        else{
           echo "No values have been set";
        }
   }
  
  
  function addInventoryBook($arr){
     foreach($arr as $elem){
        //if used get sub-category
        if($elem['condition']=='used'){
           echo $elem['isbn']."-".ucfirst($elem['condition'])
              .ucfirst($elem['sub_condition'])."&lt;br&gt;";
        }
  
        else if($elem['condition']=='new'){
           echo $elem['isbn']."-".ucfirst($elem['condition'])."&lt;br&gt;";
        }
  
     }
  }
  </code></pre>
  
  <p>All I want is to basically be able to pass two arrays to my php script</p>
  
  <p><strong>current output</strong></p>
  
  <pre><code>100001
  100002
  100003
  </code></pre>
  
  <p><strong>desired output</strong></p>
  
  <pre><code>100001   good
  100002   new
  100003   new
  </code></pre>