PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

Using Query Strings on Redirect page

  1. I'm new to query strings, and am trying to get data to post to a redirect page after submit. On my site, I'm using gravity forms so users can purchase a service. The form redirects to PayPal and all is well. After confirmation of payment, they are redirected to a new page. I've passed the query string to the redirect page, but have absolutely no idea how to post data in Wordpress to show the query string. Call me a novice developer, I guess.

    Could you give me the walk through, on how to populate data on a new page (not in a form), using the query string parameters outlined in the form settings, redirect page.

    Posted 11 years ago on Thursday March 7, 2013 | Permalink
  2. David Peralty

    You would have to use PHP to grab the query string and display it. Reading up on query strings and PHP should give you your answer. This isn't a Gravity Forms issue, but just a normal PHP one - http://stackoverflow.com/questions/8469767/php-get-url-query-string

    Posted 11 years ago on Thursday March 7, 2013 | Permalink
  3. Thanks for the quick response David. A developer here just wrote a quick fix for future readers in javascript, which we pasted right in to Wordpress:

    <script type="text/javascript">
    function getParameterByName(name)
    {
      name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
      var regexS = "[\\?&]" + name + "=([^&#]*)";
      var regex = new RegExp(regexS);
      var results = regex.exec(window.location.search);
      if(results == null)
        return "";
      else
        return decodeURIComponent(results[1].replace(/\+/g, " "));
    }
    jQuery(document).ready(function ($) {
       $('#order_number').html(getParameterByName('order_number'));
    });
    </script>
    Order Number: <span id='order_number' />
    Posted 11 years ago on Thursday March 7, 2013 | Permalink
  4. David Peralty

    I'm not a JavaScript guy (I'm a PHP guy), so that's really cool. Thanks for coming back with your solution. I really appreciate it.

    Posted 11 years ago on Thursday March 7, 2013 | Permalink
  5. Thanks for this, rcandela. Where exactly did you past the script to populate data in the redirected page?

    Thanks for help.

    Posted 11 years ago on Thursday April 25, 2013 | Permalink