Passing a URL Variable to Form on Another Page

Home Forums Quform WordPress Passing a URL Variable to Form on Another Page

This topic is: resolved
Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #7514
    lawrencepepper
    Participant

    I have a table in which the first column of each rows lists an ID that when clicked passes that ID to a new url as so:

    <code>
    <a href="http://test.gen-techno.com/update-hours/change-form?id=' . $row['id'] . '">' . $row['id'] . '</a></code>

    I on that next page when the ID is clicked I need to query the database and grab the data for that ID and use it to populate the fields in a form.

    I can not figure out how to do this. I know how to do this with the functions.php page but going that route does not allow me to send it the ID that is needed to grab the data.

    Any ideas?

    L

    #7524
    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.

    #7528
    lawrencepepper
    Participant

    What I have is a page that displays a table which was populated by a query from my database.

    The first column in the table holds the unique ID of each row which is a clickable link which will pass that unique ID variable to the URL that the link goes to.

    When the person clicks that ID it takes them to a new page in which I then need a form that will auto fill from a query to the database based on the unique ID that was passed when they clicked the link.

    SO how do I get the unique ID that they click and pass to the function listed above on the functions.php file so that it knows what record to grab.

    ?

    #7530
    lawrencepepper
    Participant

    OK,

    I understand now, I used your example above and it works great!

    One question though,

    The date field does not populate correctly.

    How do I pass a date so that the date picker in the form accurately show the date from the database.

    L

    #7576
    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.

    #13507
    Joe Dostie
    Participant

    Hi,

    I have a referring URL with a value in it but its a single item so it looks like this:

    http://69.195.124.253/~ctwocndo/adoptions/adoption-application/?petname=A..%20%20Carmen

    I am trying to take the petname and pre-populate it into an application that the user will fill out.

    I tried referring to this code but it dosent seem to work for me, this is what I have.


    function my_pre_display($form)
    {
    if (isset($_GET['petname']))
    {
    $form->setValues ('iphorm_2_1' => 'petname');
    }
    }
    add_action('iphorm_pre_display_1', 'my_pre_display');

    Any help is appreciated!

    #13525
    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.

    #13532
    Joe Dostie
    Participant

    Awesome! As usual, you got it! 🙂

    Now I have a NEW issue that appears to be introduced by this fix…

    I had followed the topic of Date default value today and everything works perfect.

    When I go to my Adoption page the date is per-populated with today’s date.

    The weird part is, now if I go FROM my adoption link, the pet name is populated but the date function no longer seems to work.

    So if I go to here:.
    http://69.195.124.253/~ctwocndo/adoptions/adoption-application/ – The date is populated and all is good.

    But if I start from here first:
    http://69.195.124.253/~ctwocndo/adoptions/adoption2/
    Then select any pet
    Then select the “Adopt Me” button on the top right
    You will be redirected to the Adoption application but ONLY the pet name is populated. The date is no longer populated.

    I have a few guesses as to why:
    1.) The variable (PetName) at the end of the URL are interfering with the DATE function
    2.) The order of the action and function
    3.) The date function needs to be integrated into the PetName function.


    function mytheme_date_today()
    {
    $now = current_time('timestamp');

    return array(
    'day' => date('j', $now),
    'month' => date('n', $now),
    'year' => date('Y', $now)
    );
    }
    add_filter('iphorm_element_value_today', 'mytheme_date_today');

    Then there is a bunch of code in between here….


    function my_pre_display($form)
    {
    if (isset($_GET['petname']))
    {
    $form->setValues(array('iphorm_2_1' => $_GET['petname']));
    }
    }
    add_action('iphorm_pre_display_2', 'my_pre_display');
    add_filter('iphorm_element_value_today', 'mytheme_date_today');

    #13565
    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.

Viewing 9 posts - 1 through 9 (of 9 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