i have searched and found this http://html.net/tutorials/php/lesson10.php
but, my question is i want to pass a couple of parameters BUT i need the same variable name .. not sure if that made sense so ex
index.php?Model=XYZ&page=1,2,34
so basically, i will want the page to pop up and goto a directory XYZ and pull the images regarding 1, 2 and 34. so most likely 1.jpg 2.jpg and 34.jpg
is that possible? Not sure what keyword to search for.
Use array syntax for your parameter names:
index.php?Model=XYZ&page[]=1&page[]=2&page[]=34
Then in your code:
$page = $_GET['page'];
echo $page[0]; // prints 1
var_dump($page);
array(3) {
[0]=>
int(1)
[1]=>
int(2)
[2]=>
int(34)
}
If you call following Url
index.php?Model=XYZ&page=1,2,34
You can do it with following PHP
$pages = isset ($_GET['pages']) ? explode(',', $_GET['pages']) : [];
print_r($pages);
foreach ($pages as $page) {
//If no Number, ignore
if (!is_numeric($page)) {
continue;
}
//Cast to Integer
$page = (int)$page;
//Work with $page
echo $page;
}
Also hear about UrlRewriting
for IIS or ModRewrite
for Apache