Can someone help me with the GET function?

Asked

Viewed 77 times

0

Making a shopping site, then have the products table and order table, where after the person buys something writes in the orders table, but wanted to record the product id in the orders table, how to do it by GET, since he already picks the id by GET to appear in the cart?

  • 2

    Can you provide the code you are using? But for recording you must use the POST method.

  • It can help yes, just put the code or the part of it that has the doubt.

  • actually is that I don’t know how to do this, so there’s no code kkkkk I don’t know where to start, I searched but I didn’t find much about

  • What language are you using in your frontend to send the data to the database?

1 answer

0

Visit the PHP documentation:

PHP: $_GET - Manual

As for him already picking up the ID by GET, if I understand correctly, you can use another variable to pass other values, separating them by the character &. GET recovers values via page URL:

http://www.pagina.com.br/index.php?id=1&outra_variavel=valor

When loading this page, to capture the value of the parameters "id" and "other variable", it is used:

$idProduto = $_GET['id'];
$outroValor = $_GET['outra_variavel'];

OBS.: If processing sensitive data, such as a password, use the POST method, and if necessary with encryption (md5, for example).

I don’t know if it helps, what your level of knowledge, or what part of the project is, so that’s what I can do at the moment. Good Luck!

Browser other questions tagged

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