Sam Cohen
asked on
Pass variables to a iframe form
Is there anyway to let say.
I have a page with vars define:
$fname="Jon";
$lname="Doe";
$email="john.doe@nothing.c om";
and i have a button and a Iframe on the same page anf in the iframe shows any site where is says;
enter you first name, last name, email address in form fields
Is there anyway, if after i click the button, transfer the vars to the form fields?
The form fields are firstname, lastname, email
I have a page with vars define:
$fname="Jon";
$lname="Doe";
$email="john.doe@nothing.c
and i have a button and a Iframe on the same page anf in the iframe shows any site where is says;
enter you first name, last name, email address in form fields
Is there anyway, if after i click the button, transfer the vars to the form fields?
The form fields are firstname, lastname, email
You can use javascript with prefix parent
e.g
parent.frame1.document.for ms[0].name .value="";
e.g
parent.frame1.document.for
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
So is it something like this:
<?php
$fname="Sam"
?>
<script>
function Onsubmit()
{
parent.frame1.document.for ms[0].name .value="<? php $fname; ?>";
}
</script>
<?php
$fname="Sam"
?>
<script>
function Onsubmit()
{
parent.frame1.document.for
}
</script>
You have to set a name for the iframe tag as in my code and replace the frame1 in your code with it.
It's impossible for javascript to read php variables unless you write them to the html and store them as inputs manually.