I’m looking into what is the best way to pass multiple values for the same parameter name via URL in PHP and then get those results.
Example:
http://www.example.com?color=blue&color=red&color=green
For some reason all the answers I can find is for other programing languages…
Advertisement
Answer
You can pass them as an array
http://www.example.com?color[]=blue&color[]=red&color[]=green
On server side use $_GET['color'],
which should return an array
print_r($_GET['color']); // Array ( [0] => green [1] => red [2] => blue )