how do I preserve the position of my elements after a save to the database? Meaning, let’s say I have a table inside which I have textboxes inside tds, and I rearrange the rows in my table and click Submit. How do I preserve the new posisition of the rows in my table without reverting back to the original position on page refresh?
Thank You
In your database, have a field called something like “sorting” or “position” and when the form is saved, serialize the data of the positions as actual positions (i.e. 0, 1, 2, 3…). When the page is initially loaded, in your query, order the results by position ASC, e.g.
SELECT * FROM txt ORDER BY position ASC;