PDA

View Full Version : POST and IFrames


page1ink.
03-01-2006, 01:09 PM
this is apparently an odd question, as I've been googling for weeks and have yet to find a solution for it >.<

I'm trying to make a backend for a site as dynamic as possible by using iframes and POST data. right now, the way it's set up is 'salebox.php' has a form containing a listbox (<select> with multiple turned on). when the user clicks an item in the listbox, the IFrame below ('./includes/salebox_iframe.php') it updates with form fields for name, model, price, yadda yadda. this is done with a Javascript onClick event that passes the index of the clicked item to the PHP script in the IFrame, which then pulls the existing information from MySQL and displays it in a form. the user edits the values and clicks a submit button that is contained in that form inside the IFrame.

in a perfect world, I would be able to have that form (salebox_iframe.php) send its POST data back to the parent page (salebox.php), which would then update the data. this, however, is not a perfect world ;_;

so I suppose the simplest way to ask this question is 'how can I pass POST data from an IFrame to its parent?' perhaps I'm making it more complex than it needs to be. if I could get PHP and Javascript to dynamically interact I think that would be a good alternative.

let me know if I'm not making any sense hehe =)

giff
03-01-2006, 01:50 PM
I would suggest AJAX for this. There are quite a few examples about. Try, http://www.devshed.com/ or http://www.ajaxfreaks.com/

I think this is the way you should be going and move away from frames.

macgyver2
03-01-2006, 01:55 PM
This sounds like a job for AJAX (http://en.wikipedia.org/wiki/AJAX). Using iframes for what you want to do is so...a couple years ago. :) I jest.

If you still want to do the iframe thing, though, I think javascript's 'parent' property should work. Have you tried that? Or (and I'm starting to grasp a bit) the 'opener' property?

page1ink.
03-01-2006, 02:10 PM
awesome, thanks ^_^ I'll read up on AJAX and let you know how it goes. with the little bit of skimming I just did, it sounds like I'll have it licked without too much trouble.

thanks again!