How to take data through the GET method?

Asked

Viewed 122 times

0

I am setting up a panel for financial control of a MEI company (This is my company). I am developing the order part, follow doubt:

The point is, I already use this GET to search the pages, how could you add to this link to take the request ID to show in the other field?

Example of the Link:

<a href="index.php?Pagina=pag&filtro=pedido">Pedidos de Vendas</a>

This Code is in the index to catch the link:

<?php
    if(isset($_GET['Pagina']))
    {
        $pagina =($_GET['Pagina']);
        if(file_exists('arquivos/'.$pagina.'.php'))
        {
            @include_once("arquivos/$pagina.php");
        }
        else
        {
            @include_once("arquivos/404.php");
        }
    }
    else
    {
        if(file_exists('arquivos/home.php'))
        {
            @include_once("arquivos/home.php");
        }
        else
        {
            @include_once("arquivos/404.php");
        }
    }
?>

Essa é a imagem, gostaria de quando clicar em editar , ir para a página com os imputs para salvar as alterações

  • 3

    If I understood what you asked: just go breaking up the pairs with & this way index.php?Pagina=pag&filtro=pedido&numero=37&outrocampo=ABC&detalhado=sim - want to confirm if this is the question, so that it is possible to formalize a response. If it is not, please [Dit] your question and explain a little better, please.

  • That’s right! Thank you very much helped!

1 answer

0

It was not very clear your doubt, but if it is what I understood, you want to add the ID of an order or product by clicking on a link.

I believe you already have an example of this in your own system, in the TASKS column each edit/delete link does just that.

Maybe you want to pass more than one parameter to a page through GET, if that’s what the rule is:

  • To pass the first parameter (variable) use ? (query) as separator;
  • If there are more parameters (variables) you want to pass to the page use & (and commercial) as tab;

Example:

<a href="index.php?Pagina=pag&filtro=pedido&idProduto=<?php echo $idProduto ?>">Pedidos de Vendas</a>

Make your doubt more clear blz...

A hug.

  • Thank you very much, the doubt was the same, this one with doubt about the &test=id thank you very much! Helped a lot!!!

Browser other questions tagged

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