$_PARAM not automatically 'seen'

I need to filter database queries based on the url param.

If I understand this… (taken from here)

Then this should work:

  1. Route is /login:school
  2. In server action I set up $_PARAM.school (1)
  3. I set it in a vallue with output on so I can see if it’s getting the value. (2)

I’m expecting to see the query parameter here but it’s empty:

I think you are mixing the api & client route.
If you create a Server Connection Route (which would point to the said API), then the $_PARAM would work.
The route /login:school is a client side route. You can access the value of school only on that page and not the server side API.

Thanks @sid that makes sense… so you’re saying this kind of route would catch the parameter correct?

And to solve my use case now I can just pass the parameter from client side to the server action - is that the best way?

Correct. Course_id should be available in $_PARAM with this in the API.

Yes. Via server connect or server connect form.
The value will be available on API in either GET or POST as per your configuration on client side.

The best way to filter the database based on the URL is to get the URL as in


@ben Thanks for chiming in!

In the URL I don’t see the query: image

I see I can access the query here:

But - what is the added benefit of taking it from a $_SERVER variable instead of passing it from the page with {{query.parameter}} ?

The reason that I gave the $_SERVER solution is because you referred to this tutorial:

If you just want to filter the database, then it is better to follow this

Thanks @ben I’ve set it up the same way as the last link.

1 Like