How to pass 2 parameters through a link with html and php

Asked

Viewed 36 times

0

My question is this: I want to pass 2 parameters through a link, but I’m having doubts about that. Can anyone explain to me how I can do such a procedure?

I’ll give you an example:

<a href="CarrinhoPT-BR.php?acao=add&id=<?php echo $rows_cursos['idDestaque']; ?>" class="btn btn-danger"><span class="glyphicon glyphicon-shopping-cart"></span> Comprar</a>

This is the link I want to send 2 parameters. As you can see there is only 1 that is acao=add&id=. I want to send 1 more that would be the user id. How can I do it?

  • failed to concatenate PHP, everything is in the same string.

1 answer

0

You can send as many parameters as you want by separating them by &.

<a href="CarrinhoPT-BR.php?acao=add&id=<?php echo $rows_cursos['idDestaque']; ?>&idusuario=999&mais outro=valor&outro=valor" class="btn btn-danger"><span class="glyphicon glyphicon-shopping-cart"></span> Comprar</a>

It is worth noting that a less verbose way to define the idDestaque is:

<?= $rows_cursos['idDestaque'] ?>

Browser other questions tagged

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