Get checkbox values with javascript and display bank data

1

I'm doing a shopping cart in PHP. I have two checkboxes (Checkout and Delivery) and I need the moment the user clicks on the checkbox Delivery the value of the delivery rate coming from the Bank is calculated with the order total.

My code:

      <form action"conteudo.php" name="frm" method="GET">
            <span class="servicos"><input id="bus"type="radio" name="rad" value="1">             Buscar no balcão<br>
        </span>
            <span class="servicos"><input id="bus"type="radio"name="rad" value"2"> Entrega</span>
                    </form>

    '<table width="310" border="1">
                      <thead>
                        <tr>
                          <td>Excluir</td>
                          <td>Qtde</td>
                          <td>Produto</td>
                          <td>Valor</td>       
                        </tr>
                        <br>
                      </thead>
                      <tbody>
                           <?php
                          foreach ($_SESSION['carrinho'] as $id => $qtde) {
                            $sql = "SELECT * FROM produto WHERE ID_PRODUTO = '$id'";
                            $end = mysqli_query($con,$sql);
                            while($resu = mysqli_fetch_assoc($end)){

                            $nome  = $resu['NOME_PRO'];
                            $preco = FormataValor($resu['PRECO_P']);
                            $sub   = $resu['PRECO_P'] * $qtde;
                            $total += $sub ;

                            <tr>
                              <td><a href="?acao=del&id='.$id.'">&#10148;</a></td>
                              <td>'.$qtde.'</td>
                              <td>'.$nome.'</td>
                              <td>R$'.$preco.'</td>
                            <tr>  
                              <td colspan="4"></td>
                            </tr>
                            <tr>  
                              <td colspan="4"></td>
                            </tr>';
                               }
                           }

                          ?> 

                     </tbody>

                     <tfoot>
                        </form>
                        <tr>  
                            <td colspan="4"></td>
                            </tr>
                            <tr>  
                            <td colspan="4"></td>
                            </tr>  
                        <tr>  
                          <td colspan="3">SubTotal</td>
                          <td>R$<?php echo FormataValor($total);?></td>
                        </tr>
                        <tr>  
                          <td colspan="3">Taxa Entrega</td>
                          <td><?php 
                          if(isset($_GET['rad'])){
                            echo $resu['TAXA_ENTREGA'];}?></td>
                        </tr>
                        <tr>  
                          <td colspan="3">Total</td>
                          <td>R$<?php echo FormataValor($total) ;?></td>
                        </tr>
                    </tfoot>
                  </table>
                  <a href="index.php">Continuar Comprando</a'>
    
asked by anonymous 14.06.2016 / 14:00

0 answers