I'm a newbie at this sort of thing and I need some specific help. I'm passing two fields in a URL from a CGI script to an HTML form. I need to print the two values in the form I'm passing them to. The URL looks like this:
http://www.nanr.org/?LN=Wilson&FN=John
I need to print the values of LN
and FN
in my form. The HTML code currently looks like this:
<input type="text" size="15" style="width:40" name ="LastName" value="">
<input type="text" size="15" style="width:40" name ="FirstName" value="">
How do I do this?
I have included the following code in my HTML Form page:
</script>
<script type="text/javascript">
function getParameterByName(name) {
name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
results = regex.exec(location.search);
return results == null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
}
</script>