add up values from radio buttons onclick without submitting form
<p>I saw on a link this ability to add up check boxes, but I need radio buttons added up instantly with any type of coding possible.</p>

<p><a href="http://www.madirish.net/tech.php?section=1&amp;article=7" rel="nofollow">http://www.madirish.net/tech.php?section=1&amp;article=7</a></p>

<p>my form is the following:</p>

<pre><code>    &lt;form action="orders.php" method="post" name="Reservar" target="_self"&gt;

        &lt;table width="800" border="0"&gt;
        &lt;?php
        foreach ($rows as $row) {
        ?&gt;
        &lt;tr&gt;
         &lt;td&gt;&lt;input name="platofuerte" type="radio" onClick="checkTotal()" value="&lt;?php echo $row['Producto_Precio']; ?&gt;" /&gt;
         &lt;/td&gt;
         &lt;td&gt;&lt;input name="platofuerte1" type="hidden" value="&lt;?php echo $row['Producto_ID']; ?&gt;" /&gt;&lt;img src='&lt;?php echo htmlspecialchars($row['Producto_Imagen']); ?&gt;' alt='image' name="imagen" id="imagen" /&gt;
         &lt;/td&gt;
         &lt;td width=""&gt;&lt;input name="" type="label" value='&lt;?php echo $row['Producto_Nombre']; ?&gt;' /&gt;
         &lt;/td&gt;
         &lt;td width=""&gt;&lt;input name="" type="label" value='&lt;?php echo $row['Producto_Descripcion']; ?&gt;' /&gt;
        &lt;/td&gt;
        &lt;td width=""&gt;&lt;input name="price" type="label" value='$&lt;?php echo $row['Producto_Precio']; ?&gt;' /&gt;
        &lt;/td&gt;&lt;/tr&gt;
        &lt;/table&gt;

                &lt;table width="800" border="0"&gt;

                        &lt;td&gt;&lt;input name="bebida" type="radio" onClick="checkTotal()" value="&lt;?php echo $row['Producto_Precio']; ?&gt;" /&gt;

                        &lt;/td&gt;

                         &lt;td&gt;&lt;input name="bebida1" type="hidden" value="&lt;?php echo $row['Producto_ID']; ?&gt;" /&gt;&lt;img src='&lt;?php echo htmlspecialchars($row['Producto_Imagen']); ?&gt;' alt='image' name="imagen" id="imagen" /&gt;

                        &lt;/td&gt;

                        &lt;td width=""&gt;&lt;input name="" type="label" value='&lt;?php echo $row['Producto_Nombre']; ?&gt;' /&gt;

                        &lt;/td&gt;

                        &lt;td width=""&gt;&lt;input name="" type="label" value='&lt;?php echo $row['Producto_Descripcion']; ?&gt;' /&gt;

                        &lt;/td&gt;

                        &lt;td width=""&gt;&lt;input name="price" type="label" value='$&lt;?php echo $row['Producto_Precio']; ?&gt;' /&gt;

                        &lt;/td&gt;

                        &lt;/tr&gt;

                        &lt;?php

                    /*}*/

                   } ?&gt;

                &lt;/table&gt;


                &lt;table width="800" border="0"&gt;


                        &lt;td&gt;&lt;input name="postre" type="radio" onClick="checkTotal()" value="&lt;?php echo $row['Producto_Precio']; ?&gt;" /&gt;

                        &lt;/td&gt;

                         &lt;td&gt;&lt;input name="postre1" type="hidden" value="&lt;?php echo $row['Producto_ID']; ?&gt;" /&gt;&lt;img src='&lt;?php echo htmlspecialchars($row['Producto_Imagen']); ?&gt;' alt='image' name="imagen" id="imagen" /&gt;

                        &lt;/td&gt;

                        &lt;td width=""&gt;&lt;input name="" type="label" value='&lt;?php echo $row['Producto_Nombre']; ?&gt;' /&gt;

                        &lt;/td&gt;

                        &lt;td width=""&gt;&lt;input name="" type="label" value='&lt;?php echo $row['Producto_Descripcion']; ?&gt;' /&gt;

                        &lt;/td&gt;

                        &lt;td width=""&gt;&lt;input name="" type="label" value='$&lt;?php echo $row['Producto_Precio']; ?&gt;' /&gt;

&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
&lt;table width="800" border="0"&gt;
&lt;tr&gt;
&lt;td&gt;&lt;input name="aperitivo" type="radio" onClick="checkTotal()" value="&lt;?php echo $row['Producto_Precio']; ?&gt;" /&gt;
&lt;/td&gt;
&lt;td&gt;&lt;input name="aperitivo1" type="hidden" value="&lt;?php echo $row['Producto_ID']; ?&gt;" /&gt;&lt;img src='&lt;?php echo htmlspecialchars($row['Producto_Imagen']); ?&gt;' alt='image' name="imagen" id="imagen" /&gt;
 &lt;/td&gt;
 &lt;td width=""&gt;&lt;input name="" type="label" value='&lt;?php echo $row['Producto_Nombre']; ?&gt;' /&gt;
&lt;/td&gt;
&lt;td width=""&gt;&lt;input name="" type="label" value='&lt;?php echo $row['Producto_Descripcion']; ?&gt;' /&gt;
&lt;/td&gt;
&lt;td width=""&gt;&lt;input name="" type="label" value='$&lt;?php echo $row['Producto_Precio']; ?&gt;' /&gt;
        &lt;/td&gt;
        &lt;/tr&gt;
 &lt;/table&gt;
&lt;input type="submit" name="Reservar" id="Reservar" value="Reservar" /&gt;
            &lt;/p&gt;
            &lt;p&gt;&amp;nbsp;&lt;/p&gt;
            &lt;p&gt;&amp;nbsp;&lt;/p&gt;


           &lt;input type="text" size="2" name="total" value="0"/&gt;
        &lt;/form&gt;
</code></pre>

<p>in the last input text box, the totals of the selected radio buttons appear, in theory.  How can I make this work. this propposed  code is for a group of radios with the same name and the radio buttons in adjacent lines of text</p>

<p>my php page runs queries of each group name of radio buttons so I end up with up to 4 items per group. I need to add up totals of those radios sellected from each group.</p>

<p>the suggested script for check boxes is the following:</p>

<pre><code>&lt;script type="text/javascript"&gt;
    function checkTotal() {
        document.listForm.total.value = '';
        var sum = 0;
        for (i=0;i&lt;document.listForm.choice.length;i++) {
          if (document.listForm.choice[i].checked) {
            sum = sum + parseInt(document.listForm.choice[i].value);
          }
        }
        document.listForm.total.value = sum;
    }
&lt;/script&gt;
</code></pre>