Forum Moderators: coopster

Message Too Old, No Replies

str replace, help with address bar

header str replace

         

MrWhippy

1:57 pm on Aug 26, 2008 (gmt 0)

10+ Year Member



Hi all,

I have a script that exits to the same page it was run on but also passing data in the address bar, to say what should be showed on the page, however as this script is run on several pages i have had to generate the url dynamically,

using


$url = "http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];

the problem i have is every time i use $url in the header it gets a new ?***** added to it, i have tried to figure a way round this using string replace to remove ?**** after each page loads but have so far have had no success, can anyone shed any light on this.


$_SESSION['url'] = str_replace(?*,'',$url);

is the one of the string replaces i have tried.

thanks

eelixduppy

4:23 pm on Aug 26, 2008 (gmt 0)



I'm not sure where the asterisks are coming from, but i would use the trim [php.net]() function to get what you want. You can just trim off any unwanted characters in the URL:

$url = 'http://' . $_SERVER['HTTP_HOST'] . trim($_SERVER['REQUEST_URI'], '*?');

Try that and see what you get.

MrWhippy

7:02 am on Aug 27, 2008 (gmt 0)

10+ Year Member



Ah thanks i see,

I was using the asterisk as i had found some info that suggested it was a wildcard. ill give that a try

MrWhippy

11:01 am on Aug 27, 2008 (gmt 0)

10+ Year Member



Problem solved, thanks