Send ID of each respective while pass

Asked

Viewed 32 times

1

The code that I have is a shopping cart, certain that shows the separate purchases in sellers, may have more than one seller in the shopping cart as in the image below: inserir a descrição da imagem aqui

now what I need is to move to the next step of the purchase process, on another page and with the items only of the seller I chose, so I will use the ID of the seller I get on the page that creates the cart, and then I call a "buy" button that you send to me. Until then ok. the problem is that it always sends the last id loaded, and not the respective id from which I clicked... how can I fix it? follow the code: this is form q sends the store ID variable and it changes every step of the while.

echo '<center><button class="btn btn-success" rel="5" onclick="submete();">Comprar</button></center>';
                        echo '</td>';
                        echo '</table>';                          
                        echo '<form id="envia" method="POST" action="envia.php">';
                        echo '<input type="hidden" name="total" value="'.$codigo_loja.'" />';          
                        echo'</form>';
  • why instead of sending a post with the id do not send to the next page with the ID in the type url nome-da-proxima-pagina.php?id_vendedor=xxx ??

  • because it is the store id, I wish to leave hidden. but this is a good strategy.

  • my opinion that if it can’t be screenVoce needs to find another solution, it’s leaving complicated by nothing. If you open the browser console to find the store id the same way, even if you look at the source code you can, sending it as a post will not make it invisible.

1 answer

1


As you work with multiple forms, place the Submit button inside the form and insert the type Submit into it. So:

echo '<form id="envia" method="POST" action="envia.php">'; // <-- aqui

echo '<center><button type="submit" class="btn btn-success" rel="5" onclick="submete();">Comprar</button></center>';
//                            ^ 
//                            .............. aqui
echo '</td>';
echo '</table>';                          

echo '<input type="hidden" name="total" value="'.$codigo_loja.'" />';          
echo'</form>';

It will probably solve the problem.

  • 1

    OUR GOD TOO, THANKS TO YOUR BEAUTIFUL!

  • @douglasdutra kkkkk quiet

Browser other questions tagged

You are not signed in. Login or sign up in order to post.