passing variables from one form to another

Home Forums Quform WordPress passing variables from one form to another

This topic is: resolved
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #17651
    patdundee
    Participant

    Hi Guys
    On my site I have a form which also using WP custom fields, with hidden fields in the form set as the relevant parameter names, and uses the redirect to another page. Using a child theme I capture all the elements that are sent via the post action.

    What I would like to try and add to this functionality is the ability to pass variables to a different form located on another page and auto fill elements on the new form with the value that is passed from the previous form.

    For example:
    Someone wishes to pay a deposit on an item, rather than pay in full. (This selection is made via radio buttons) The price and product code and passed to the functions php in the child theme. I need to be able to pass the price and the product code to the relevant hidden elements on the form on the new page.

    I then need it to auto set the values in three of the fields in the new form. 2 of these fields are drop down select and the third is preset value depending on the selections made in the drop down values of field 1 and 2

    Is there a way this can be achieved please.

    Many thanks
    P

    • This topic was modified 8 years, 4 months ago by patdundee.
    • This topic was modified 8 years, 4 months ago by patdundee.
    #17654
    patdundee
    Participant

    As a change to the above (which should make it easier to work out)

    I do already catch these variables and they are saved in their own session names, which i prefer as the variables and their values do not show in the url when redirecting.

    So all i need to do is find a way to make the value of the hidden fields = the value of the sessions.
    input type="hidden" name="iphorm id" value="php session"

    Can this be achieved?

    Many thanks
    P

    #17670
    Ally
    Support Staff

    You don't have permission to view this content. Please log in or register and then verify your purchases to gain access.

    #17674
    patdundee
    Participant

    Hi Ally

    It is not filling in the value. I have told the page to print the session to the screen so I can see that the session is live and has a value.

    Here is what I have put in the functions php


    function my_pre_display($form)
    {
    $form->setValue('iphorm_2_57', $wp_session['sku']);
    }
    add_action('iphorm_pre_display_2', 'my_pre_display');

    The element 2_57 is also a hidden one
    P

    • This reply was modified 8 years, 4 months ago by patdundee.
    • This reply was modified 8 years, 4 months ago by patdundee.
    • This reply was modified 8 years, 4 months ago by patdundee.
    #17678
    Ally
    Support Staff

    You don't have permission to view this content. Please log in or register and then verify your purchases to gain access.

    #17679
    patdundee
    Participant

    Hi Ally
    setting global inside the function did not work but doing it this way does

    
    function my_pre_display($form)
    {
    	$wp_session = WP_Session::get_instance();
        $form->setValue('iphorm_2_57', $wp_session['sku']);
    }
    	add_action('iphorm_pre_display_2', 'my_pre_display');
    

    P

    • This reply was modified 8 years, 4 months ago by patdundee.
Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.
Be inspired. © 2024 ThemeCatcher Ltd. 20-22 Wenlock Road, London, England, N1 7GU | Company No. 08120384 | Built with React | Privacy Policy