title: html array index name to variable
body: <p>I have a form such as the below:</p>
  
  <pre><code>&lt;form name="basketSelectionForm" action="processBasket.php" method="POST"&gt;
              &lt;div id="tabs-1"&gt;
                  &lt;table cellpadding="10" cellspacing="10" width="inherit"&gt;
                      &lt;tr&gt;
                          &lt;td&gt;&lt;img alt="itemNameb" src="images/itemName.jpg" width="70px" height="70px"/&gt;&lt;/td&gt;
                          &lt;td&gt;Qty. &lt;input value="0" id="itemName" name="basket[itemName]" type="text" style="width:40px;"/&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/td&gt;
  
                          &lt;td&gt;&lt;img alt="itemName" src="images/itemName.jpg" width="70px" height="70px"/&gt;&lt;/td&gt;
                          &lt;td&gt;Qty. &lt;input value="0" id="itemName" name="basket[itemName]" type="text" style="width:40px;"/&gt;&lt;/td&gt;
  </code></pre>
  
  <p>Now when I go to second page to look at the entries of the array, I do this:</p>
  
  <pre><code>&lt;?php
      $itemsBasket = array( );
      $itemsBasket = $_POST['basket'];
      echo "&lt;h1&gt;The Items Are...&lt;/h1&gt;&lt;br&gt;";
      //print_r($itemsBasket);
  
  
      foreach ($itemsBasket as $value) 
      {
          if($value &gt; 0){
              echo $value . "&lt;br&gt;";
          }
      }
  
  ?&gt;
  </code></pre>
  
  <p>This will print the value at the indexes of the array...but I need to store the name of the index so lets say the item is chocolate and value of 12. I want to extract that index name from array to store it in variable and then assign value to that variable...</p>
  
  <p>Any way I can do that? right now I get only the value while iterating...</p>
  
  <p>Thanks for help and sorry if question isn't clear I will help explain better if so...</p>
  
  <p>UPDATE: this is the unexpected output....</p>
  
  <blockquote>
    <p>whitethoab: Array woolthoab: 22 shemag: 22 undershirt: 1 serwalthoab:
    22 socks: 12</p>
  </blockquote>
  
  <p>and this is the definition of the element showing as two dimensional array...</p>
  
  <pre><code>&lt;td&gt;&lt;img alt="White Thoab" src="images/whitethoub.jpg" width="70px" height="70px"/&gt;&lt;/td&gt;
                          &lt;td&gt;Qty. &lt;input value="0" id="whitethoab" name="basket[whitethoab]" type="text" style="width:40px;"/&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/td&gt;
  </code></pre>