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.

Trying to get variable from form

  1. Hi,

    I am trying to do the following:

    I have a search form, from I want to sent the input (a search term) on to the next page, in which I need the variable.

    I use the form settings to send the input via query string on to the next (result) page. Although I can see in the source that it uses the "post" method, the query is still visible in the url., which I thought it should not do when using "post".

    Also, when I try to use the variable by using:

    <?php echo $_POST["input"]; ?>

    on the result page, I can see the result for a second, and then it disapears when the page is fully loaded.

    When I copy the source code and fill in the "action" parameter by hand, and then use that as a form, it does work as expected; I can echo out the result, and the query is not added to the url.

    Since I would like to track the form submissions I prefer using the plugin form, then the handcoded version though. Am I doing something wrong?

    Thanks in advance.

    Posted 10 years ago on Tuesday June 1, 2010 | Permalink
  2. When passing data via query string it is going to do so via GET, not post. Query string actions are done using the GET method which is why it's showing up in the query string. So it isn't going to post the custom redirect data to your confirmation page, it's going to do so via GET by passing it in the query string.

    Posted 10 years ago on Tuesday June 1, 2010 | Permalink
  3. Thx Carl. I am sorry, but I made a mistake in my explanation...

    As far as I understood from this article, if GET is used, it should be possible to echo out the data from the form with:

    <?php echo $_GET["input"]; ?>

    That's what I've tried with the Gravity Form (so not POST, as I mentioned in the earlier post), but that doesn't seem to work?

    To be a bit more clear (hopefully): I need the field input to construct a URL to load something in an iFrame on the next page.

    Thx in advance.

    Posted 10 years ago on Tuesday June 1, 2010 | Permalink
  4. Gravity Forms posts it's information to itself and processes the data. It then displays the confirmation page OR redirects to a page or URL of your choosing.

    If you need that redirect page to have access to the form field data you need to pass that data to the confirmation page using query string parameters to pass data to it. This is found under the Confirmation tab of the form settings and then choose to pass data to the form and then construct your query string.

    That is how you get data that is posted, however you are trying to get data that is no longer available at the point you are trying to implement that. So you'd have to do it another way via passing the data via the query string.

    Posted 10 years ago on Tuesday June 1, 2010 | Permalink
  5. I guess I just have to code my own form that uses POST as a method then.

    Thanks again for taking the time to explain!

    Posted 9 years ago on Wednesday June 2, 2010 | Permalink