I can not display html in the middle of php

-2

I'm trying to insert a cart that is in html on a page php , the code inserted outside the php shows the cart normally. The library with css is invoked correctly because it mounts the cart when placed outside, I would like to understand what may be happening. I've tried putting the embedded code in the middle of php by escaping aspas and it did not work.

The code I am trying to insert into the html is this:

//MOSTRAR CARRINHO DE COMPRA
function carrinho(){
    //VERIFICAR SE EXISTE UMA SESSION
    if ($_SESSION){
        //SEPARAR NOME DE QUANTIDADE OU VALORES
        foreach($_SESSION as $nome => $quantidade){
                // VERIFICAR SE A QUANTIDADE NÃO ESTÁ ZERADA
            if ($quantidade > 0){
                    if(substr($nome,0,9) == 'produtos_'){

                    // Pegar ID da Session
                    $id = substr($nome,9,(strlen($nome) -9));                           

                    // MONTAR O CARRINHO
                    $PD = mysql_query("SELECT 
                                            'produtos'.id_produto, 
                                            'produtos'.'status',
                                            'produtos'.nome,
                                            'produtos'.codigo_empresa                                               
                                            FROM
                                            'produtos'
                                            WHERE
                                            'produtos'.id_produto = '".mysql_real_escape_string( (int) $id)."' ");

                    while($list = mysql_fetch_assoc($PD)) {
                            $QTD = $quantidade;

                    ?>  

                        <div class="container">
                          <form class="cartContent clearfix" method="post" action="#">
                            <div id="cartContent"> 
                              <div class="item head"> <span class="cart_img"></span> <span class="product_name fsize13 bold">PRODUTO</span> <span class="remove_item fsize13 bold"></span> <span class="total_price fsize13 bold">TOTAL</span> <span class="qty fsize13 bold">QUANTITY</span>
                                <div class="clearfix"></div>
                              </div>
                              <div class="item">
                                <div class="cart_img"><img src="../assets/images/demo/shop/1.jpg" alt="" width="60" /></div>
                                <a href="shop-page-full-product.html" class="product_name"><span>Man shirt XL</span> </a> 
                                <a href="#" class="remove_item"><i class="fa fa-times"></i></a>
                                <div class="qty">
                                  <input type="text" value="1" name="total" maxlength="3" id="total" />
                                  </span></div>
                                <div class="qty">
                                  <input type="text" value="1" name="valor_unitario" maxlength="3" id="valor_unitario" />
                                  &times;

                                  <input type="text" value="1" name="quantidade" maxlength="3" id="quantidade" />

                                </div>
                                <div class="clearfix"></div>
                              </div>
                              <div class="clearfix"></div>
                            </div>
                          </form>
                        </div>  
                      <?php         
                    }//while
                }//if prod
            }// if qtd
        }//foreach
    }// if session

Variable contents $ list:

Array ( [id_produto] => 1417 [status] => 1 [nome] => MANCAL DO PI NO DA BALANÇA Ø 50MM SEM TRAVA [codigo_empresa] => RO 0245 )
    
asked by anonymous 08.02.2017 / 17:04

1 answer

0

I was able to resolve this situation, inadvertently my had not noticed that there was another form on my page, thus causing conflict and not allowing the page to render correctly. Problem solved.

    
08.02.2017 / 17:59