D
D
Dmitry Mukhin2018-03-28 13:30:51
PHP
Dmitry Mukhin, 2018-03-28 13:30:51

How to leave a request in the url get on the transition?

If we are on the page site.ru/page1.php?test=1, then when we go to another page, this get request should be saved - site.ru/page2.php?test=1
Tell me where to dig?

Answer the question

In order to leave comments, you need to log in

4 answer(s)
L
Lander, 2018-03-28
@usdglander

$url = 'http://site.ru/page2.php' . '?' . http_build_query($_GET);

I
ipokos, 2018-03-28
@ipokos

I understand that the url "site.ru/page1.php site.ru/page2.php ..." is the result of pagination, "?test=1" in the url these are parameters, filters or the like.
to display pages, use some kind of cycle in which urls are generated, and concatenate additional. options

// где то в пагинации что то типа:
foreach($pagesArray as $page){
   $page['url'] .= '?' . $getParms;
}

D
Dmitry, 2018-03-28
@demon416nds

add it to the href of links when generating the page

T
Talyan, 2018-03-28
@flapflapjack

to save one variable test then
page2.php :
and to save any variables passed to get then

$link="/page2.php?";
foreach($_GET as $key=>$value)
{
$link.="$key=$value&";
}

echo "<a href=\"$link\">page2</a>";

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question