I already have a URL which looks like this,/admin/add_to_list/' .$payer. '/' .$tid. '?credit=1
knowing that i already have a $_GET
in my url, I want to add another thing on my url. Is it possible that my new url will look like this,
/admin/add_to_list/' .$payer. '/' .$tid. '?credit=1/silentmode
Thank you.
Your example will result in fetching the same URL as the first, but now $_GET['credit']
will be equal to "1/silentmode"
instead of "1"
.
Path elements must always come before the query string, which itself must always come before the fragment. That is simply the syntax of a URL - after all, you wouldn't expect example.com.www//http:
to work, would you?
No. Anything after the first ?
until the first #
(if any) is the query string.
You need to deconstruct your URL and put the extra path element before the query string.
Use the ampersand (&) to have multiple $_GET values. Example:
index.php?name=joe&surname=smith
You can then retrieve them individually like so:
$name = $_GET['name'];
$surname = $_GET['surname'];