PHP Recordset Paging, changing url Parameter -
bit of newby php & mysql, , use dreamweavers inbuilt functions, trying hands dirty , understand things little more , subsequently fix couple of problems.
i have file (search.php) when viewed has 2 url parameters 'letter
' , 'search
' 'search.php?letter=a&search=no'
within body of page, have recordset paging function (from dreamweaver). when using paging, end url similar this
'search.php?pagenum_results_empty=1&totalrows_results_empty=2937&letter=a&search=no'
very want change parameter 'search
' 'no
' 'yes
'. can work out, need remove 'search=no
' query string, , add 'search=yes
' link. i'm not not able remove query string, or barking wrong tree.
any advice gratefully received
php code
$issearch = $_get['search']; $querystring_results_empty = ""; if (!empty($_server['query_string'])) { $params = explode("&", $_server['query_string']); $newparams = array(); foreach ($params $param) { if (stristr($param, "pagenum_results_empty") == false && stristr($param, "totalrows_results_empty") == false) { array_push($newparams, $param); } } if (count($newparams) != 0) { $querystring_results_empty = "&" . htmlentities(implode("&", $newparams)); } } $querystring_results_empty = sprintf("&totalrows_results_empty=%d%s", $totalrows_results_empty, $querystring_results_empty);
link recordset paging code
<?php if ($pagenum_results_empty < $totalpages_results_empty) { // show if not last page ?> <a href="<?php printf("%s?pagenum_results_empty=%d%s", $currentpage, min($totalpages_results_empty, $pagenum_results_empty + 1), $querystring_results_empty); ?>"> <img src="images/arrow-next.png" width="58" height="97" alt=""/> </a> <?php }?>
try this:
str_replace('search=no','search=yes',$_server['query_string']);
Comments
Post a Comment