is there a way to render a form when a button is pressed ? PHP

I am looking for some help in core PHP. I want to know how to display a form in a window when a button is pressed. It should be like the conditional rendering in react or svelte etc. I don’t want to use any framework any laravel.