Adhoc add data to table used for form dropdown

Hello. Let’s say that we have three tables: People, Certificates and Countries:

People (‘id’, ‘name’, ‘surname’)

Certificates(‘id’, ‘person_id’, ‘country_id’)

Countries(‘id’, ‘name’)

Form related to my certificates add action contains following drop down fields: Name and Surname (populated based on People table), Country (populated based on Countries table). It also contains a text input field named Description.

How to make my form more user friendly and allow to add People or Countries tables records while filling the form, e.g. by adding a Add new person link etc.?

Is there any way how to do this without using client side scripts or AJAX? Just using (Cake)PHP and HTML?

Thank you in advance.

You can definitely do that but you are just restricted to the predefined amount of related entitiy fields you are generating.
See CakePHP 4 Tutorial 2022 - Add with Associations (Part 9) - YouTube

Thank you very much for your reply and also for the video. Nevertheless, the requirement of knowledge of amount of new entities is quite limiting. Does anybody know if there exist any suitable plugin to add field dynamically?

Thank you in advance.

so you want dynamic fields which aren’t added via client side scripts? How are you expecting this to happen just by pure PHP? You could maybe find a Helper somewhere which injects JS and does the dynamic field logic for you but in the end “dynamic fields” in the frontend will always be related to some scripts in the frontend.

So now, when I know that there is no other solution beside client side scripting, I can use it without any remorse. Thank you once more!