Most up-to-date Doc or Tutorial -- conditional php server side include

Rather than spend another 20 minutes more trying to find the best solution – (Searching gives me 99% questions and/or years 2018 to 2019 topics) I know Forum readers can point straight to what I need to Review

In a PHP & MYSQL project

  1. User login --> 2) form page --> 3) confirmation of submitted form page

Instead of stepping from page to page I want to use the Single Page App method.

The login API to check User credentials against the database table Users works fine – if User login values match 1 user record then the Login page directs to the Form. Another API query fetches the Authorized User details (full name, address, city, email, postal code, telephone) and these fields are bound to appropriate fields in the Form as Read-only text.

The rest of the options are open for User selections.

This Form page is the one I want to INCLUDE once my Security provider has okayed this User to see the Form.

I need to read the most complete demonstrations - Remember, this is not a node.js app.

I’m confused about the way to conditionally include this page because I see 2 different ways.

1 way is to create a conditional region on my Login (index.php) which will Include the form file (minus some of the header tags of a stand-alone page) After the condition is True that an Identity ID is detected.

As in –

<div id="conditional1" is="dmx-if" dmx-bind:condition="(security2.identity > 0)"></div>
    <?php include 'working_form2.php'; ?>

The other way, I would think is to add actions to my API which begins with my Global Security Provider so that it is the API action that loads the Form page into a given Conditional region.

So, my confusion illustrates why I’m looking for the most complete illustration of getting that Form loaded condtionally.

Thank you for your help.

Check the docs explaining how to create a SPA. This is how to do this on a PHP/ASP/.NET site:

Thank you, Teodor.

This is the page I found months ago.

It is straightfoward and how I did things in php/html

But I’ve followed the steps to create a login and protected content which involve –

which gives us Example …

I’ll figure it out!