Taking URL Variables from One Page, and using another

Asked

Viewed 700 times

0

I have a link in which I receive the parameters in the url completely, in case it points to an HTML where I have my inputs, and I receive the URL with the parameters, what I need is to take the variables of this URL and use in another page when you give a Submit in a form...

the LINK

https://www.lascivacam.com.br/pagseguro/[email protected]&token=A391905466FD2ED45ECD0&[email protected]&currency=Brl&itemid 1=1&itemDescription1=30%20Chips&itemAmount1=30.00&usuario=Lascivacam&itemquantity 1=1&Reference=7|1|30&[email protected]

I need to save the variables and save them in the variables and be able to use them normally in other pages... but I’m not getting...

I can use php or jquery but I have no idea why it is more than 1 variable that I will need to load...

Just to be clear :

MY INDEX and PURE HTML WHERE THERE IS AN INPUT, in this input when I fill the data I can choose which type of payment I make, and in it there is a php for each of the payment types, so the accuracy to pick up the variables above to be able to use in the completion of values and other data that will stay in the bd and at the time of payment...

2 answers

1


You can use a session to store these values.

In the session you can store values that "persist" between a page and another as they are kept in HTML requests to your server.

As in the code below:

Page that receives variables:

session_start();
$_SESSION['nome_var'] = $_GET['var'];

Page that uses variables session_start(); access the values by $_SESSION['nome_var'] setate.

1

It would be ideal to make a single PHP script.

You can pass an input with the id of the selected payment method to the PHP script, and then use a switch statement.

Example.

switch ($_POST['tipo_pagamento']) {
case 0:
    echo "sua logica de programação";
    break;
case 1:
    echo "sua logica de programação";
    break;
case 2:
    echo "sua logica de programação";
    break;
}
  • rsrs, in the case has already been done, because it was by the Url, but it’s all ok, my problem now and another need to do a BD check where it checks the status of the payment if it is different take the paid user and transaction ID to check and the ID and the amount of chips q he bought and updates in another table this data...

Browser other questions tagged

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