Jump to content

Archived

This topic is now archived and is closed to further replies.

$cripts

URL Arguments

Recommended Posts

Ok i have test.php?p=userr&f=signature&page=2
how would i check if the URL contains page= argument and get rid of it if it does exist

Share this post


Link to post
Share on other sites
isset() and empty()

[a href=\"http://www.php.net/isset\" target=\"_blank\"]http://www.php.net/isset[/a]
[a href=\"http://www.php.net/empty\" target=\"_blank\"]http://www.php.net/empty[/a]

May be useful. I don't know what you mean with "get rid of it" though

Share this post


Link to post
Share on other sites
what do u mean??
i want to check the $_SERVER['argv'] if page=somethign exists if it does it want to remove it from the $_SERVER['argv'] variable and stick the argv variable at the end a link so id have
test.php?this=that&page=3
become
test.php?this=that
without useing $_GET or $_REQUEST

Share this post


Link to post
Share on other sites
And for what you'd use that?

I really don't see anything useful. Maybe changing links to remove unnecessary parts?

But in this case, some scripts will accept empty vars. Like:

if (isset($_GET['test'])) ...

Share this post


Link to post
Share on other sites
ok.......well sense ur not helping me.....
does it matetr what i use it for?
i need a way to proccess the url arguments and remove the page arument from it
so i would have
like test.php?f=view&t=1&page=5&sort=ASC
$arguments = $_SERVER['argv'];
// code to remove certain arg
so i now have
test.php?f=view&t=1&sort=ASC
and i need to do it from calling a function

Share this post


Link to post
Share on other sites
Since you keep on refering to "argv" am I correctly assuming that you are running from the CLI interface to PHP not from a webserver?

If that's the case, you probably want to look at the functions [a href=\"http://www.php.net/parse_str\" target=\"_blank\"]parse_str()[/a] and possibly [a href=\"http://www.php.net/parse_url\" target=\"_blank\"]parse_url()[/a].

Ken

Share this post


Link to post
Share on other sites
no im running from the server side but i need to use this for a pagination script as i call it from a function and it creates the url and i need to remove the page= argument

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.