I have this variable on my form
<script>
var type = 2;
</script>
and on the same page I am calling this iFrame
<iframe src='http://www.genpowerusa.com/crm/formal_quote_new2.php' frameborder='0'></iframe>
What I am unsure is, how could I send the variable to the php form and use the variable on the quote form, the variable is static, I have two pages that call the same iFrame.
Is such thing possible?
Assign an id to your iframe:
<iframe id='foo' src='http://www.genpowerusa.com/crm/formal_quote_new2.php' frameborder='0'></iframe>
Add a js line:
document.getElementByid("foo").src='http://www.genpowerusa.com/crm/formal_quote_new2.php?type='+type;
What this does is,pass your variable as a PHP url parameter.You can access it by using the following code in php:
$type=$_GET['type'];
Sending information via javascript to a frame that is not in the domain of the scope is not possible, because of cross site scripting . That would not be secure (eg imagine inserting an iframe with Facebook and grabbing some data from the frame...).
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.