Not a php expert here so...
Some records coming out of a database contain some characters that mess up the urls in which they are inserted. i.e. the "&" is the main culprit.
So I have this code:
$myurl = "<a href='http://www.url.com/blah.php?event=" . $event . "'>"
Well, if $ename contains the record "Dogs & Cats" then the "&" messes it up.- cats gets cut of when vitiing that url..
Well it seems "&" is translated in newer browsers as "%26". Is there a simple way to have php convert the & to %26 without it making an actual "&" exist in the url?
I could not do it using htmlspecialchars or htmlentities so I did somethign like this:
$ename = str_replace("&", "%xxx", $eventname);
$ename = str_replace("xxx", "26", $ename);
I replaced the & with %xxx and then xxx with the 26 - this works. replacing straight to %26 causes PHP to use an actual &..
Thanks