Using iFrame to post data into.... and out of.

HTML, CSS and anything else that deals with client side capabilities.

Moderator: General Moderators

Post Reply
simonmlewis
DevNet Master
Posts: 4435
Joined: Wed Oct 08, 2008 3:39 pm
Location: United Kingdom
Contact:

Using iFrame to post data into.... and out of.

Post by simonmlewis »

I have an issue where we are running a PHP site. It is showing a list of categories, but I need to be able to select one of the categories and the results appear inside the iFrame.

Then, you can select any of the results and the info will 'post' it back to the main content page where the iframe resides.

For example: you have a list of Car Makes (Ford, Opel etc). You select Ford, and in the iFrame, lots of form images appear, one for each model.

You then select a model, and it appears, via being posted to the URL, at the top of the main page.

I know about posting into URLS and all PHP stuff - it's the iFrame thing I have a problem with. Because we are allowing people to go back a page (which causes "Posting form" problem), and using that FORM method doesn't work.
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Re: Using iFrame to post data into.... and out of.

Post by John Cartwright »

Take a look at the target attribute on your <form> tag. Otherwise, you can access the parent/child window in javascript as well --> See google link.
simonmlewis
DevNet Master
Posts: 4435
Joined: Wed Oct 08, 2008 3:39 pm
Location: United Kingdom
Contact:

Re: Using iFrame to post data into.... and out of.

Post by simonmlewis »

Thanks, will do.
I know you can post INTO an iframe by posting to the name of the frame, the name you assign to the iframe.
But not sure how to post from within it, to OUTSIDE it.

And why is there an 'Attention' warning on the page? This query is about HTML. And I am in the HTML section.
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Re: Using iFrame to post data into.... and out of.

Post by John Cartwright »

simonmlewis wrote:Thanks, will do.
I know you can post INTO an iframe by posting to the name of the frame, the name you assign to the iframe.
But not sure how to post from within it, to OUTSIDE it.
Right.. and if you read the links I provided you, you would have noticed the target="_parent" (html form) or window.parent (javascript) option. :D
simonmlewis wrote:And why is there an 'Attention' warning on the page? This query is about HTML. And I am in the HTML section.
Thats just my signature.
Post Reply