I am passing information from one page to another in the URL
The URL is as follows: "http://localhost/order.asp?phone =Apple+iPhone+5 +64gb+White+-+%C2%A3500&Subm it=Submit"
The code on the next page is as follows:
It writes the following:
Your Phone is: Apple+iPhone+5+ 64gb+White+-+£500
How do I get it to remove the + inbetween the words and replace it with a space
The URL is as follows: "http://localhost/order.asp?phone =Apple+iPhone+5 +64gb+White+-+%C2%A3500&Subm it=Submit"
The code on the next page is as follows:
Code:
<script language="JavaScript">
<!--
function getValueFromUrl(name)
{
var url = '' + this.location;
var idx = url.indexOf('?');
if(idx==-1)
return null;
var query = "&" + url.substring(idx+1);
var qs = query.toLowerCase();
var key = "&" + name.toLowerCase() + "=";
var begin = qs.indexOf(key);
if(begin==-1)
return null;
else
begin += key.length;
var end = qs.indexOf("&", begin);
if (end == -1)
end = query.length;
return unescape(query.substring(begin, end));
}
// -->
</script>
</head>
<body>
<script>
document.write("Your Phone is: "+getValueFromUrl('phone'));
</script>
Your Phone is: Apple+iPhone+5+ 64gb+White+-+£500
How do I get it to remove the + inbetween the words and replace it with a space
Comment