I have an iframed form placed on a landing page. When users come to this landing page from an affiliate link, a parameter is placed in the url (http:thelandingpage.com?c3=1). When they submit the iframe form, I need to send that variable (c3=1) to the next page. How could I achieve that?
Here is the option I'm exploring:
Pulling the parameter from the parent page url
Note: this code is being placed inside the iframe
(Javascript)
<script language="JavaScript">
function processUser()
{
var parameters = window.parent.location.search.substring(1).split("&");
var temp = parameters[0].split("=");
c3 = unescape(temp[1]);
//Assign "c3=" to a var
var c3variable = c3;
//Append c3 Variable
document.getElementById("c3").innerHTML = c3variable;
}
processUser();
</script>
(HTML)
<strong>If variable displays, that's a success!</strong>
<br>
c3: <span id="c3"></span><br>
Of course it's not working properly though. It displays the first parameter in the iFrame's "src", not the first parameter of the parent page.
I can't move on until I grab the "c3=1" parameter.. But my next step would be to stick that variable in a hidden field or something in order to send it to the next page as a query string.
Please help!