title: PHP Sum Total of Elements from Checkboxes
body: <p>What would be the best way to output the values of the check boxes which are checked, but I want to get a total.  I have tried to use sum() to total the values selected but I just keep getting double 0 0.</p>
  
  <p>My checkbox.php </p>
  
  <pre><code>&lt;?php
   if(isset($_POST['submit'])){
   if(!empty($_POST['shipping'])) {
  
   ?&gt;
   &lt;div class="container"&gt; &lt;?php
   //Loop through shipping array to fetch individual shipping so that we     can use them
   echo "&lt;h2&gt; Your Shipping Costs are: &lt;/h2&gt;";
   foreach($_POST['shipping'] as $shipping) {
   //Print all the shipping
    echo $shipping;
    }
  
    }
    else{
    echo "&lt;b&gt;Please Select at least One Option.&lt;/b&gt;";
    }
    ?&gt;&lt;/div&gt;&lt;?php }
     ?&gt;
  </code></pre>
  
  <p>then my html</p>
  
  <pre><code> &lt;div class="container"&gt;
      &lt;form action="checkbox.php" method="post"&gt;
  
         &lt;label class="head"&gt;Select Your Timezone or Other Shipping  Options:&lt;/label&gt;&lt;br/&gt;&lt;br/&gt;
          &lt;input type="checkbox" name="shipping[]" value="$190.00"&gt; &lt;label&gt;Freight to Eastern USA&lt;/label&gt;&lt;br/&gt;
         &lt;input type="checkbox" name="shipping[]" value="$245.00"&gt;&lt;label&gt;Freight to Western USA&lt;/label&gt;&lt;br/&gt;
         &lt;input type="checkbox" name="shipping[]" value="$75.00"&gt;&lt;label&gt;Residential Devivery&lt;/label&gt;&lt;br/&gt;
         &lt;input type="checkbox" name="shipping[]" value="$100.00"&gt;&lt;label&gt;Liftgate Service&lt;/label&gt;&lt;br/&gt;
         &lt;input type="checkbox" name="shipping[]" value="$0.00"&gt;&lt;label&gt;Will Call&lt;/label&gt;&lt;br/&gt;&lt;br/&gt;
         &lt;input type="submit" name="submit" Value="Add to Shopping Cart"/&gt;
  
      &lt;/form&gt;
  </code></pre>
  
  <p>All help greatly appreciated.</p>