-2

PHP Page I have not understand what I have to do on this to show the net value.

It doesn't show me any value. What should I do please help me.PDF File

Here is the table code. I can't see the shipping charge net value in table footer.

  <table width="100%">
                  <tr>
                    <td colspan="8" class="estilo4"><CENTER><strong> <h1>Payment</h1></strong></CENTER></td>
                  </tr>
                  <tr bgcolor="black" border="1" solid  #5D6975 cellspacing="0" cellpadding="0">
                    <th class="estilo1">'.$TRACK.'</th>
                    <th class="estilo1">'.$zones.'</th>
                    <th class="estilo1">'.$FECHA.'</th>
                    <th class="estilo1">'.$Mer.'</th>
                    <th class="estilo1">'.$DESTINA.'</th>
                    <th class="estilo1">'.$NUMBERPHONE.'</th>
                    <th class="estilo1">'.$ESTADO.'</th>
                    <th class="estilo1">'.$deliveryboy.'</th>
                  </tr>
                  </thead>
                <tbody>
                ';

                $sql=mysql_query("SELECT * FROM courier_online WHERE payment = 'OK' AND email='$qname' AND date   BETWEEN '$desde' AND '$hasta'");
                while($express=mysql_fetch_array($sql)){
                $initial = 0; // Empezar a contar desde 0
                $initial = $initial + $row['shipping_subtotal'];
                $codigoHTML.='  
                    <tr>
                        <td class="estilo3">'.$express['cons_no'].'</td>
                        <td class="estilo3">'.$express['shipping_subtotal'].'</td>
                        <td class="estilo3">'.$express['date'].'</td>
                        <td class="estilo3">'.$express['user'].'</td>
                        <td class="estilo3">'.$express['rev_name'].'</td>
                        <td class="estilo3">'.$express['r_phone'].'</td>
                        <td class="estilo3">'.$express['status'].'</td> 
                        <td class="estilo3"></td>                           
                    </tr>   
                </tbody>
<tfoot>
                                                    <tr>
                                                        <td colspan="2" style="text-align: right;" rowspan="1">
                                                            <b><?php echo $initial; ?></b>
                                                        </td>
                                                    </tr>
                                                </tfoot>                
                    ';

                }
        $codigoHTML.='

              </table>

1 Answers1

0

I see two issues with your code:

1) You're echoing the value of $initial rather than concatenating it to the value of your $codigoHTML variable. Because of this it is not included in the HTML document (as contained in the variable).

2) Your generated HTML is not valid. You should move the closing TBODY tag and the entire TFOOT block outside the closing brace for the while loop.

BrianS
  • 13,284
  • 15
  • 62
  • 125