• Resolved richardz

    (@richardz)


    Hé there,

    For the non-profit organization i work for we’re making a website and profide courses people can register to. An easy way is to embed a mailform to each course. Nicer would be that each course has a button to click on wich leads to a page with the mailform. Is there a way to track the url of each course in the mailform. I tried url_referrer, but that give’s only the url of the page where the form is.

    Gr. Richard

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Support Elana Davis

    (@elanasparkle)

    Hello @richardz

    Thank you for reaching out to us. You can use the URL to pass in a value from the previous form and use a hook to capture that value and populate the form. If you create an action hook on the form called my_awesome_hook and put the below in the functions.php, grab the URL’s ID and post it on the form. Then from the course page, you can render something like

    https://[INSERT DOMAIN]/testpage/?id=7

    function render_my_awesome_hook( $form_id, $post_id = null ) {

    if(isset($_GET[‘id’])){
    $id = $_GET[‘id’];
    }

    $page = false;
    if(isset($_GET[‘page’])){
    $page = $_GET[‘page’];
    }

    if ( $post_id ) {
    $value = get_post_meta( $post_id, ‘your_meta_key’, true );
    }
    ?>

    <div class=”wpuf-label”>
    <label>A demo field</label>
    </div>

    <div class=”wpuf-fields”>
    <input type=”text” name=”my_custom_field” value=”<?php echo esc_attr( $id ); ?>”>
    </div>
    <?php
    }
    add_action( ‘my_awesome_hook’, ‘render_my_awesome_hook’, 10, 2 );

    Thanks
    Elana D.

    Thread Starter richardz

    (@richardz)

    Thnx!! I’ll try your solution, and let you know if it worked. ??

    Plugin Support Elana Davis

    (@elanasparkle)

    Per our terms, I’m going to resolve this thread. Let us know if there is anything else you need.

    Thanks
    Elana D.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘url referrer’ is closed to new replies.