Digital Point Forums
Moneygram

Go Back   Digital Point Forums > Design & Development > Programming > PHP
Google Analytics
Log In to view
your analytics

Reply
 
Thread Tools
  #1  
Old Nov 3rd 2009, 1:55 pm
ramysarwat ramysarwat is offline
Grunt
 
Join Date: Jul 2009
Posts: 78
ramysarwat is an unknown quantity at this point
how to remove variable and its value from url ?

how to remove a variable and its value which can be any value for example 123456 from this url

http://www.eample.com/test.php?a=123456&b=754&c=2254
Reply With Quote
  #2  
Old Nov 3rd 2009, 2:07 pm
Colbyt Colbyt is offline
Starcaller
 
Join Date: Feb 2006
Posts: 3,055
Colbyt is a splendid one to beholdColbyt is a splendid one to beholdColbyt is a splendid one to beholdColbyt is a splendid one to beholdColbyt is a splendid one to beholdColbyt is a splendid one to beholdColbyt is a splendid one to behold
Are you asking how to not have it show in the URL?

Or how to extract it from the URL to use in a script for some purpose. This is quite common.
Reply With Quote
  #3  
Old Nov 3rd 2009, 2:53 pm
ramysarwat ramysarwat is offline
Grunt
 
Join Date: Jul 2009
Posts: 78
ramysarwat is an unknown quantity at this point
Quote:
Originally Posted by Colbyt View Post
Are you asking how to not have it show in the URL?

Or how to extract it from the URL to use in a script for some purpose. This is quite common.
i want to extraxt it from the url (remove it) and use the rest of the url
Reply With Quote
  #4  
Old Nov 3rd 2009, 5:03 pm
morgano's Avatar
morgano morgano is offline
Champion of the Naaru
 
Join Date: Jul 2009
Posts: 166
morgano is on a distinguished road
Code:
$url_array = array();
$url_array = parse_url($your_url);

print_r($url_array);
Reply With Quote
  #5  
Old Nov 3rd 2009, 5:07 pm
ramysarwat ramysarwat is offline
Grunt
 
Join Date: Jul 2009
Posts: 78
ramysarwat is an unknown quantity at this point
Quote:
Originally Posted by morgano View Post
Code:
$url_array = array();
$url_array = parse_url($your_url);

print_r($url_array);
thank you morgano but this way will devide the url into parts

all what i want to do is remove the unwanted part which is a=123456
Reply With Quote
  #6  
Old Nov 3rd 2009, 5:21 pm
jestep's Avatar
jestep jestep is offline
of the Nightfall
 
Join Date: Dec 2004
Location: Austin
Posts: 2,398
jestep is a name known to alljestep is a name known to alljestep is a name known to alljestep is a name known to alljestep is a name known to alljestep is a name known to all
Can you explain how you intend on using the remainder of the url. I think it will help give a more appropriate answer.

If you need to use the url as-is without the value pair, you would want to use parse url, and then reconstruct the url without the undesired variable. This way you are certain to remove the full parameter and value.
Reply With Quote
  #7  
Old Nov 3rd 2009, 5:24 pm
ramysarwat ramysarwat is offline
Grunt
 
Join Date: Jul 2009
Posts: 78
ramysarwat is an unknown quantity at this point
Quote:
Originally Posted by jestep View Post
Can you explain how you intend on using the remainder of the url. I think it will help give a more appropriate answer.

If you need to use the url as-is without the value pair, you would want to use parse url, and then reconstruct the url without the undesired variable. This way you are certain to remove the full parameter and value.
i will try and see what happen
Reply With Quote
Reply

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Remove a variable from QUERY_STRING? digitalunix ASP 4 May 14th 2009 8:27 am
Need to pass URL into HTML from URL variable? Seqqa PHP 3 Jun 19th 2008 2:37 pm
How to Remove php variable on redirect? ascensions Apache 1 Sep 23rd 2006 9:20 pm
how do I remove ssi, htm from a string variable t7584 ASP 2 May 8th 2006 7:44 am
how do I remove ssi, htm and a character from a string variable t7584 PHP 1 May 7th 2006 7:24 am


All times are GMT -8. The time now is 6:23 am.