I am really new to html, php and the surrounding world.
I need to present and interact with a database query and table, that holds some columns containing dropdowns that contain many options.
I managed to create a function that creates the select statement from the data given and the underlying table, and I managed too to create the table with all those select statements. The problem is that as soon as I increase the query limit from 80 to 100 rows the server goes on memory overflow. There are 4-5 select columns each around 300-500 options.
One solution would be to limit the output to 50 elements and navigate paging down (I understand that this may be the simplest and most straightforward option).
I am evaluating another option for select statements:
Instead of having many repetitions of the same select, where among them the only difference is which element is selected by default, I could create a file with the select statement and include it many times while adding afterwards only an additional (duplicate) option with the currently selected selection.
Eg.
<select>
<option>opt1</select> <option>opt2</select> <option>opt3</select> <!-- the line with the previous options will be contained in file common for each different row -->
<option selected>opt2</select>
</select>
This will drop down massively the size of the dynamically created html data created by the php code, but I AM NOT SURE if anything would change regarding the memory overflow problem as at the end the same very huge data will be elaborated by the browser ( but may be not by the server ? ). SO FIRST QUESTION IS: will the previously describe approach have any effect in memory overflow on the server side ?
The second approach that was indicated by e.g. chatgpt is to include a javascript script that will populate dynamically the select statement.
This approach obliges my to delve too in javascript while actually I have to manage at the same time: Postgres, php, html.
So I am actually reluctant to take that route. So the SECOND QUESTION IS ON YOUR OPINION about and relative experience.
The optimal approach would be to have a library that manages all the above and takes care of all aspects without bothering me, and without requiring weeks to learn.
So the THIRD QUESTION is: DOES IT EXIST SOMETHING SIMILAR ?
Any other ideas are welcome !