this_end_up
07-29-2009, 12:26 AM
Hello all,
I am sending out a small email blast to my clients. I would like to offer them a free download of a report, but I don't want to have them re-fill all of their information. Therefore, I would like to have someone help me out with a bit of code that will parse the URL and place the separated items into the form fields. Then they can hit submit and be done.
I have the following URL:
www.test.com/land.html?id=test&first=michael&last=Jones&city=pasadena
I would like to have a form with the following fields:
-id
-first
-last
-city
Once a person has landed on the page, the forms will automatically fill out and they will hit submit.
This is what I have so far...but it is not parsing correctly. Can anybody help me out to add in the right code?
<HTML>
<HEAD>
<SCRIPT type="text/javascript">
function getQuerystrings(inputId) {
var urlString = parent.document.URL;
var queryString = urlString.substring(urlString.indexOf('?'),urlString.length);
inputObj = document.getElementById(inputId);
inputObj.value = queryString;
}
</SCRIPT>
</HEAD>
<BODY onload="getQuerystrings('urlQuery')">
<form id="form1">
<input id="urlQuery" type="text" value="">
<input id="urlQuery" type="text" value="">
<input type="button" value="Submit">
</form>
</BODY>
</HTML>
Thanks
I am sending out a small email blast to my clients. I would like to offer them a free download of a report, but I don't want to have them re-fill all of their information. Therefore, I would like to have someone help me out with a bit of code that will parse the URL and place the separated items into the form fields. Then they can hit submit and be done.
I have the following URL:
www.test.com/land.html?id=test&first=michael&last=Jones&city=pasadena
I would like to have a form with the following fields:
-id
-first
-last
-city
Once a person has landed on the page, the forms will automatically fill out and they will hit submit.
This is what I have so far...but it is not parsing correctly. Can anybody help me out to add in the right code?
<HTML>
<HEAD>
<SCRIPT type="text/javascript">
function getQuerystrings(inputId) {
var urlString = parent.document.URL;
var queryString = urlString.substring(urlString.indexOf('?'),urlString.length);
inputObj = document.getElementById(inputId);
inputObj.value = queryString;
}
</SCRIPT>
</HEAD>
<BODY onload="getQuerystrings('urlQuery')">
<form id="form1">
<input id="urlQuery" type="text" value="">
<input id="urlQuery" type="text" value="">
<input type="button" value="Submit">
</form>
</BODY>
</HTML>
Thanks