title: PHP, remove trailing comma in array
body: <p>There must be a kazillion topics and help related to this, but I cannot figure out how to implement anything to work with my setup.</p>
  
  <p>HTML:</p>
  
  <pre><code>    &lt;!-- SHOW/HIDE TEXT FIELD --&gt;
      &lt;!-- IF BITTEN ANIMAL="YES" or BITTEN "BOTH" Show Field --&gt;
  &lt;div id="hidden_textfield10" style="display:none;"&gt;
      &lt;p class="data_bold"&gt;What kind of animal&lt;/p&gt;&lt;div class="data_small"&gt;What kind of animal has your pet bitten? Check all that apply:&lt;/div&gt;
      &lt;label for="Wild"&gt;&lt;input class="form_style" type="checkbox" value="Wild" id="Wild" name="whatKindofAnimal[5]" /&gt;Wild&lt;/label&gt;&lt;br /&gt;
      &lt;label for="Bird"&gt;&lt;input class="form_style" type="checkbox" value="Bird" id="Bird" name="whatKindofAnimal[4]" /&gt;Bird&lt;/label&gt;&lt;br /&gt;
      &lt;label for="Cat"&gt;&lt;input class="form_style" type="checkbox" value="Cat" id="Cat" name="whatKindofAnimal[3]" /&gt;Cat&lt;/label&gt;&lt;br /&gt;
      &lt;label for="Dog"&gt;&lt;input class="form_style" type="checkbox" value="Dog" id="Dog" name="whatKindofAnimal[2]" /&gt;Dog&lt;/label&gt;&lt;br /&gt;
      &lt;label for="Other-Animal"&gt;&lt;input class="form_style" type="checkbox" id="Other-Animal" name="whatKindofAnimal[1]" onclick="if(!this.checked) document.getElementById('otherKindofAnimal').value='' " /&gt;Other&lt;/label&gt;
      &lt;!-- IF BITTEN ANIMAL="Other" Show Field --&gt;
  &lt;div class="Other-Animal" style="display:none;"&gt;
      &lt;input class="form_style" type="text" placeholder="Please Specify" id="otherKindofAnimal" name="whatKindofAnimal[1]" /&gt;
  &lt;/div&gt;
      &lt;!-- END "Other" Field --&gt;
  </code></pre>
  
  <p>PHP:</p>
  
  <pre><code>&lt;strong&gt;What Kind of Animal:&lt;/strong&gt; &lt;?php $name = 
  $whatKindofAnimal = implode(", ", $_POST['whatKindofAnimal']); {echo 
  htmlspecialchars($whatKindofAnimal);} ?&gt;&lt;/p&gt;
  </code></pre>
  
  <p>I know the name is the same for the last radio button and the textbox, but this works for my setup and is irrelevant with my dilemma. Disregard the HTML.</p>
  
  <p>How do I correct the php to remove that last comma?</p>
  
  <p>Thanks!!!
  Tracy</p>