Copy link to clipboard
Copied
I am sending URL parameters between pages like so:
<a href="<?php printf("%s?pageNum_Get1=%d%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s", $currentPage1, min($totalPages_Get1, $pageNum_Get1 + 1), $queryString_Get1, $townstr, $makestr, $modelstr, $countrystr,$bodystr, $neckstr, $boardstr, $pickupsstr, $memberstr, $postcodestr, $colourstr, $offersstr,$valuestr,$valueconditionstr, $yearstr, $yearconditionstr, $conditionstr, $selectorderstr,$selectascdescstr,$tabstr ); ?>"> Next</a>
This is the code for a 'Next page' function. which uses a hyperlink, Next
This works fine.
Now, the problem I have is I want to pass these variables from another page, but NOT using a hyperlink.
For example when the page is exited it run the following code:
$insertGoTo = "index.php";
if (isset($_SERVER['QUERY_STRING']))
{
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
How do I add the URL parameters to this code so that the information is passed between the pages?
Thanks
Adam
Copy link to clipboard
Copied
I would think you can use the same technique with a redirect as you would with a link. I'm no good with php, but it would look something like:
$insertGoTo = "index.php?pageNum_Get1="printf("%d%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s", min($totalPages_Get1, $pageNum_Get1 + 1), $queryString_Get1, $townstr, $makestr, $modelstr, $countrystr,$bodystr, $neckstr, $boardstr, $pickupsstr, $memberstr, $postcodestr, $colourstr, $offersstr,$valuestr,$valueconditionstr, $yearstr, $yearconditionstr, $conditionstr, $selectorderstr,$selectascdescstr,$tabstr );