Jump to content

Pass variable to IFRAME


prudens

Recommended Posts

well you can pass value to the script inside iframe through $_GET, $_SESSION...

 

if you are calling things inside iframe on the client side, then you can use DOM.

passing variables back to main can be done using $_SESSION but i dont think this can be read from the client-side so you can use DOM here also.

Link to comment
Share on other sites

  • 4 weeks later...

I have similar issue.  I need to "pull variables" from the parent page on my child page so I can use it in several places on the child page

 

I am dynamically calling iframes so can't use the GET

 

Here is what I have in the parent

 

<script type="text/javascript">function populate(){

top.frames['frame1'].document.form2.from.value = '$email';

top.frames['frame1'].document.form2.name.value = '$fname $lname';

}

  </script>

 

 

That works before if the child page is "Form" as it sets the values.  But I have children pages that are just text and I want to be able to use the NAME within the text on the child page. 

 

"$FNAME $LNAME, thanks for visiting..."

 

 

Link to comment
Share on other sites

Guest Xanza

Use sessions... You'll be able to continue the session into the iframes and grab your needed variable data that way.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.