My end goal is to have a script that takes user input from one pageA, submits to pageB which then displays the parameter values entered on PageA. My problem is that the values are being displayed with any included spaces being replaced with the plus sign. Any help would be appreciated.
pageA code:
[HTML]<html>
<body>
<form type="get" action="pageB.html" target="new" onSubmit="window.open('','new','width=450,height=3 00,status=yes,resizable=yes,scrollbars=yes')">
spoke with: <input name="spokeWith" type="text" value="" size="32">
phone number: <input type="text" name="phoneNumber" size="32">
email address: <input type="text" name="emailAddress" size="32">
other: <input type="text" name="other" size="32">
<input name="submit" type="submit" value="generate comments!">
</form>
</body>
</html>
[/HTML]
pageB code:
[HTML]<html>
<head>
<SCRIPT LANGUAGE="JavaScript">
function getParams() {
var idx = document.URL.indexOf('?');
var params = new Array();
if (idx != -1) {
var pairs = document.URL.substring(idx+1, document.URL.length).split('&');
for (var i=0; i<pairs.length; i++) {
nameVal = pairs[i].split('=');
params[nameVal[0]] = nameVal[1];
}
}
return params;
}
params = getParams();
</script>
<title>generated order comment:</title>
</head>
<body>
<SCRIPT LANGUAGE="JavaScript">
spokeWith = unescape(params["spokeWith"]);
phoneNumber = unescape(params["phoneNumber"]);
emailAddress = unescape(params["emailAddress"]);
other = unescape(params["other"]);
document.write("Spoke With: " + spokeWith + " //" + "<br>");
document.write("Phone Number: " + phoneNumber + " //" + "<br>");
document.write("Email Adderss: " + emailAddress + " //" + "<br>");
document.write("Other: " + other + " //" + "<br>");
</script>
</body>
</html>[/HTML]