Using the submitted information in another page

Once someone submit a form would you like to do something else with that information? Like displaying it in another page? If so keep reading! In this tutorial i am going to show you how to do that using the Smart Forms Query API.

For this demo i am going to use the form template ‘Service price calculation’

What i want to do is show to my users their last Service selection and its total price in another page:


Getting Started

Important: This tutorial assume that you have some experience with PHP and HTML if you don’t have experience with them this tutorial might be too hard to follow. In that case please check the last section “What if i don’t know PHP or HTML”

To show the form information in another page you will need three things.

1.-The id of the form: This information can be found in the Smart Forms main page

2.- The id of the fields that you want to display: You can get that information in the field designer

3.- A custom plugin: This plugin will be used to create your new page, in this tutorial i am going to create a plugin that will generate a table with the information that i need and will add it to a page or post with the shortcode [my-custom-table].

To keep this tutorial as small as possible i am going to skip the details of creating this plugin but you will be able to download it at the end of the tutorial.

Using the Query Api to retrieve information

To show the information with the Query Api we need to do three things:

1.- Load the Query Api Libraries

2.- Create the query

3.- Generate html to display the information


1.- Load the Query Api Libraries

To do this step we just need to require the path of the Query Api like this:

2.- Create the query

To create the query we are going to do 2 things:

a.- Create an SmartFromsQuery instance and pass as parameter the id of the form (for this example it will be the form id 152)

b.-  Create the query

The first thing i need to do is specify the fields that i want to retrieve using the method ‘AddField’, in this demo i want to display the Service Type (rnField3) and Total (rnField4).

In this demonstration i just want to show each user its own information so i will also add a filter that will display only the information of the current logged in user.

3.- Generate html to display the information

Now that i have my query. I just need to call the method GetResults()

This will return an array of rows, each row will have the fields that i defined previously (using the AddField method). So lastly i just need to display that array, i will just write a simple html to display it:


And that’s it!

at the end my code should look like this:


now i just need to use the shortcode [my-custom-table] in a page to display my page that i just did.

This page is very simple but i hope you now have a grasp of what can be done using the query api. If you have any question please let me know =).

What if i don’t know PHP or HTML

The query api is very easy to use so i think that if you are just a little familiar with html you still will be able to do some basic or intermediate pages.  If you want to learn more about html please check this page.

If you don’t know (and don’t want to know) anything about html or you just don’t want to go through the hustle of coding everything yourself i recommend you to check the Add On Smart Pages (, this add on lets you do almost the same (actually the QueryApi is based on this plugin) using an easy to use designer.

P.S. In case you want the full plugin code, here it is =) smart-forms-query-api-demo

One Comment

  • sergio April 30, 2019 at 1:48 pm

    not work :S