How to handle variable number of request parameters in PHP (or any other server side script) ?

eternalthinker

eternalthinker

@eternalthinker-Kvsi5Y Oct 24, 2024
To quote a familiar example, consider uploading multiple photos in facebook:

We upload a random number of photos, and after upload they all show up in the same page. We can add captions to any or all of them. And this is all saved together.

Now consider how the request is sent when we hit the 'Save' button.
If each picture has, say, 2 features (caption, location) and there are N pictures, 2*N POST/GET variables are sent to the server.

My question is, how to properly handle such variable number of parameters by properly distinguishing them?

Here is a better example:
Consider all photos in an album are displayed. We can tick any or all of the photos and hit delete. So how do we determine which images are ticked efficiently at the server side?

(Hope the question is clear!)

Welcome, guest

Join CrazyEngineers to reply, ask questions, and participate in conversations.

CrazyEngineers powered by Jatra Community Platform