has anyone experience problems passing urls containing the & symbol

I ahve a page that counts clicks.

The url are passed to the page and stored in the db the user is then passed on using the header() function.

When it encounters a url with a & symbol it cuts off anything that follows it eg

www.wherever.com?operate=book&somethingelse=blah

is cut to www.wherever.com?operate=book

ive tried putting the & symbol in other places using test dummy urls and in every instance the outcome is the same in that anything after the & is chopped.

I have tried a number of suggestions from alt.php which included using & in the db to deal with any potential html problems relating to the & symbol

I have tried urlencode, and stripslashes both in the sending and receiving pages and variants of.

The result is aleays the same.

heres the code that sends the url

/*
<a href=\"clicktrack.php?link=http://$row[webadd]\">Visit Website</a>

*/

heres the code that receives
/*

$link=$HTTP_GET_VARS['link'];
if(!$link){
$link="http://www.airport-accommodation.co.uk";
}else{
$query="select count from link_count where url = '$link'";
$result=@($query);
if(@mysql_num_rows($result)>0){
// if the url exists in the database
$data=@mysql_fetch_array($result) ;
$count=$data[0]+1;
$query="update link_count set count = '$count' where url = '$link'";
$result=@($query);
}
else{
// add the url to the database
$query1="insert into link_count values ('$link', '', '')";
$result1=mysql_query($query1);
$query2="UPDATE link_count SET count=count+1 WHERE url=$link" ;
$result2=mysql_query($query2);
}
}
//things tried to see the output
//echo $link= stripslashes($link);

//echo $link= urlencode($link);//

//echo $link= urlencode(stripslashes($link));//

//header("Location: urlencode($link)");
header("Location: $link");

*/

    Seems to me that I remember that I had these same problems with one particular version of Netscape (sorry can't remember which one). I use the & symbol in tons of my links on my site and don't have a problem with any of the browsers I test (netscape 6,6.2,ie5.5,6.0,opera 6.0). So, are you sure it's not just the browser you are using?

    Matt Wade
    codewalkers.com

      hmm might be..im using ie5.5 ill test in on the others on monday.

      i suspect it isnt though, as it handles the url fine via a html page.

      The problem only arises when its passed through the php page.

        Have you tried urlencode() fuction?

        Regards
        T. A. Barry

        Get FREE domain with every hosting.
        Upto 50 MB Web Space and So many features,
        just for $79.99 per yr.
        www.BestPriceHost.com

          <snip>Have you tried urlencode() fuction?

          maybe you didnt read my post properly, yes i have.

            Write a Reply...