Quick question about session variables

My login page creates session variables through my server action page. the session name is ‘custId’ .
For the life of me i’m not sure how to add the variable result to my page using the data bindings.

Of course this works absolutely fine:
<?php echo("{$_SESSION['custId']}")?>
and returns the data as expected.
What would the wappler equivilent be?
not sure how to get server side variables to display on the page using the data bindings panel, something like

{{$_SESSION.custId}} ?

I’ve tried setting up a session manager, doesn’t work…

Any tips would be greatly appreciated!

It’s not possible to do this. That’s the point of server session variables - they are not available on the front end like that. You can use PHP code for this indeed.

The session manager on the front end works with browser sessions, that’s totally different than server sessions.

You need to assign it to a variable in your server action and click the “output” option… Then it will become available on the client side through a Server Connect or form submission.

Although there is an output option on a session assignment, it doesn’t work.

@Teodor, please can that be removed? It is very confusing to new users!

Ok so please bear with me, i’m so new to Wappler.
Ok, so my server action inserts a record into a customer database, I then use the identity parameter (which returns the db id for the created row) to create my session variable custId. this all works fine


so if i’m understanding correctly, i then do something like this to create a new variable?

Question is how to access it from any page i may need it (for a query ect) Do i need to set up a sessions manager, or initialize it?

Thanks again.

For a query you don’t need to access it on the page.
Server sessions are accessible on the server side, in the server actions directly. All you need is to just define it under $_SESSION in every server action you need it, and then it will be available, once set.

Ahhhhhh makes sense. I’m making an spa with lots of routing.
/landing/customer/ displays an area with some query results on it based on the session variable of the customer Id
/landing/customer/add/ pops up a modal to add a new customer. Upon completion the session Id is set with the new customer Id, the modal closes and your routed back to /landing/customer/
Only problem is you have to refresh the browser to get the new results to display. If I route with post variables for the customer Id to that page, would the route refresh without having to refresh the browser,? or is there something I’m overlooking?