Support » Fixing WordPress » Transfering data from one page to another

  • I have made a form that calculates the price of a certaint product, this is done on page one, since i want the customer to instantly be able to calculate the price of the product he wants i need this form to be on the frontpage, i want the customer to be able to click ‘order now’ once the price/product pleases him. what i cant figure out is how i transfer the data from the frontpage(page1) to the order page(page2).

    Example: Customer lands on frontpage, fills in form, presses submit, gets the price of the product, clicks ‘order now’ goes to the order page where a another form is waiting, with his product still there and well(the one he calculated at the homepage)

    TLDR: I need to transfer an array from one function, to another function in another page.

Viewing 1 replies (of 1 total)
  • You can simply use GET parameters.

    For example:

    When you send your form you check the values and attach them to the URL you are forwarding to.

    http://example.com/your-product/?value=1234

    On the page you check for the get parameter in PHP and assign the value to the whatever you like:


    <?php
    if ( isset( $_GET[‘value’] ) {
    $value = $_GET[‘value’];
    }
    ?>

    Obviously this is just pseudo code, you would have to sanitize the value of the get parameter, etc.

    • This reply was modified 4 years, 2 months ago by Growtheme.
    • This reply was modified 4 years, 2 months ago by Growtheme.
Viewing 1 replies (of 1 total)
  • The topic ‘Transfering data from one page to another’ is closed to new replies.