| | |
Querystring
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Thread Solved |
•
•
Join Date: Mar 2009
Posts: 23
Reputation:
Solved Threads: 0
Hi folks,
my url querystring is
i want to remove
from this url.
Please help
Thanks
my url querystring is
PHP Syntax (Toggle Plain Text)
querytring.php?checkin=10/11/2009&checkout=10/01/2009&minprice=100&maxprice=200&page=1
i want to remove
PHP Syntax (Toggle Plain Text)
&page=1
Please help
Thanks
Rahul K
They say, its not possible. Well it is, and relatively easy to accomplish!
They say, its not possible. Well it is, and relatively easy to accomplish!
0
#2 31 Days Ago
well i dont understand ur problm vry well but i think u can remove that piece of info from the php code where u r generating that query string...
Please elaborate ur problem and paste code if possible in order to get better clarification.
I guess u r using some1 else's code..
Please elaborate ur problem and paste code if possible in order to get better clarification.
I guess u r using some1 else's code..
•
•
•
•
Hi folks,
my url querystring is
PHP Syntax (Toggle Plain Text)
querytring.php?checkin=10/11/2009&checkout=10/01/2009&minprice=100&maxprice=200&page=1
i want to remove
from this url.PHP Syntax (Toggle Plain Text)
&page=1
Please help
Thanks
-1
#3 31 Days Ago
IS the 'page' parameter actually doing anything? You could just not set it in the first place. OR you could just ignore it, i.e. not have $_GET['page'] do anything. Once the 'page' has been passed to the new page, even if you remove the bit with str_replace() or similar, $_GET['page'] will still exist. You could get rid of it by unset($_GET['page']).
If you really need to get rid of the offending parameter and can't do this from the original parsing function, use str_pos() to find the start of '&page=' and str_replace() to replace all characters from that point onwards with '' OR use str_pos() and substr() to truncate from that point onwards.
If you really need to get rid of the offending parameter and can't do this from the original parsing function, use str_pos() to find the start of '&page=' and str_replace() to replace all characters from that point onwards with '' OR use str_pos() and substr() to truncate from that point onwards.
Dunna letta dem afool ya - duh reppa sistema is da evil. INDETERMINACY is alive anda wella - force a duh issue.
•
•
Join Date: Mar 2009
Posts: 23
Reputation:
Solved Threads: 0
0
#4 31 Days Ago
Guys actually i was looking for this. apologies if you could not get me.
PHP Syntax (Toggle Plain Text)
function remove_querystring_var($url, $key) { $url = preg_replace('/(.*)(\?|&)' . $key . '=[^&]+?(&)(.*)/i', '$1$2$4', $url . '&'); $url = substr($url, 0, -1); return ($url); } echo remove_querystring_var($_SERVER['QUERY_STRING'],'page');
•
•
•
•
IS the 'page' parameter actually doing anything? You could just not set it in the first place. OR you could just ignore it, i.e. not have $_GET['page'] do anything. Once the 'page' has been passed to the new page, even if you remove the bit with str_replace() or similar, $_GET['page'] will still exist. You could get rid of it by unset($_GET['page']).
If you really need to get rid of the offending parameter and can't do this from the original parsing function, use str_pos() to find the start of '&page=' and str_replace() to replace all characters from that point onwards with '' OR use str_pos() and substr() to truncate from that point onwards.
Last edited by itsrahulk; 31 Days Ago at 3:53 am.
Rahul K
They say, its not possible. Well it is, and relatively easy to accomplish!
They say, its not possible. Well it is, and relatively easy to accomplish!
0
#5 31 Days Ago
ok.. this removes the 'page' parameter from the url u pass but i m just curious whats d practical use of it? I cant see none..
•
•
•
•
Guys actually i was looking for this. apologies if you could not get me.
PHP Syntax (Toggle Plain Text)
function remove_querystring_var($url, $key) { $url = preg_replace('/(.*)(\?|&)' . $key . '=[^&]+?(&)(.*)/i', '$1$2$4', $url . '&'); $url = substr($url, 0, -1); return ($url); } echo remove_querystring_var($_SERVER['QUERY_STRING'],'page');
•
•
Join Date: Mar 2009
Posts: 23
Reputation:
Solved Threads: 0
0
#6 31 Days Ago
actually in my project paging it being display after searching the records. records are being paged.so there is a long query string which i can't assembe using the $_GET[] , so i used the server varialbe $_SERVER['QUERY_STRING'], which in turn apending the page variable again and again in the url querystring while moving over the pages, to remove this problem i thought i must remove this page varialbe so that page class again can append it's page parameter only once.
if you know some better way of doing it kindly suggest me
Thanks.
if you know some better way of doing it kindly suggest me
Thanks.
Rahul K
They say, its not possible. Well it is, and relatively easy to accomplish!
They say, its not possible. Well it is, and relatively easy to accomplish!
![]() |
Similar Threads
- how to hide querystring in asp.net2.0 (Python)
- Problem with querystring trimming (VB.NET)
- About querystring (PHP)
- Get querystring (JavaScript / DHTML / AJAX)
- can i retrieve the break tag from querystring? (HTML and CSS)
- Help with Querystring error (PHP)
- Requesting Querystring (ASP)
Other Threads in the PHP Forum
- Previous Thread: Binary Tree - How to get total left and right children?
- Next Thread: PHP Web FTP Software
| Thread Tools | Search this Thread |
ajax apache api array back basic beginner binary broken cakephp checkbox class cms code computing confirm cron curl database date delete display dynamic echo email error file files filter folder form forms function functions gc_maxlifetime google host href htaccess html iframe image include insert integration ip java javascript joomla limit link login loop mail malfunction memmory memory menu mlm multiple mysql navigation oop parsing paypal pdf php problem query radio random recursion regex remote script search server sessions sms snippet soap source space sql syntax system table thesishelp trouble tutorial update upload url validation validator variable video web xml youtube






