View Feed
PHP Programmers
Community for PHP Programmers : Ask questions, doubts and help each other get better at PHP
192 Members
Join this group to post and comment.
eternalthinker • Jan 31, 2012

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

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!)

Share this content on your social channels -