Post system

Asked

Viewed 26 times

-1

I think the title n was very clear but I will explain right here what I need and I am not getting good results.

Well what I’m trying to do is this.

On my page link it looks like this -> "www.site.com/Test? registration=1 "

This value " 1 " is the ID, so far so good, but what I wanted is another field of my database as for example the field Code.

Making this link look like this -> "www.site.com/Test? registration=A1g667100b"

This is my code.

<?php
    $Pagina = (isset($_GET['Codigo'])) ? $_GET['Codigo'] : 1;
    $BancoD = "SELECT * FROM cadastro ORDER BY id ASC";

    $Val = mysqli_query($conexao,$BancoD);
    $Total = mysqli_num_rows($Val);
    $Quantidade = 1;
    $NumeroPagina = ceil($Total/$Quantidade);
    $PaginaInicial = ($Quantidade*$Pagina)-$Quantidade;

    $Bancod = "SELECT * FROM cadastro ORDER BY id ASC LIMIT $PaginaInicial,$Quantidade";
    $Val= mysqli_query($conexao,$BancoD);
    $Total = mysqli_num_rows($Val);

    while ($NovelPost = mysqli_fetch_array($Val)){
        echo $NovelPost['Nome'];
        echo $NovelPost['Idade'];
        echo $NovelPost['Cidade'];
        echo $NovelPost['Codigo'];              
    }
?>

1 answer

0

In this case you will do so:

www.site.com/Test? registration=1&code=A1g667100b

But I suggest you start learning the post method as well, if this data is confidential. If it is not, you can pick up via GET without problem. Be very careful with information on GET.

  • Thank you so much for the tip of the Post, but in the case of the link, would still be showing the Number 1, what I want is that the link is only with the code without the ID number.

  • In this case it is precisely why you are sending in your form by the GET method. Switch to method='POST' in the form of your html it sends without putting anything there. But also change your PHP to POST instead of GET to get the data.

Browser other questions tagged

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