When using URl’s you can break one if you don’t urlencode.
var newurl = encodeURIComponent(url);
PHP uses rawurlencode
1 2 3 4 5 6 7 8 9 10 11 |
<script> function dog() { changer = document.getElementById('newval').value; alert(changer); // THIS WILL SHOW "DOG & CAT" var changercoded = encodeURIComponent(changer); alert(changercoded); //THIS WILL SHOW "DOG %26 CAT" self.location = "dashboard.php?boardnamex=" + changercoded + ""; } </script> |