Let's say I have a web page that displays a list of names and addresses (produced using PHP & MySQL, but that's not relevant for this discussion).
I can put a link on this page that will open up a new browser window for the purposes of entering some search criteria, eg:
<A HREF='search.htm' onClick="window.open('search.htm', 'RIC','width=300,height=300,resizable=no,scrollbars=no'); return false;">search window</a>
The HTML code in search.htm is just a regular FORM. But my question is - how do I ensure that when I click the SUBMIT button on the pop-window that the data is posted back to the main display page (which thereby causes a revised list to be displayed)? I know it's to do with 'target' and 'POST', but I'm can't seem to put my finger on the info I need to make this happen (in a cross-browser compatible way).
Perhaps I have to in some way 'name' the target page in the same way I might do a frame?
Should be an easy one for someone that knows...
That's a good one
My first thought is to use the parent child relationship to populate hidden fields on the parent page with the values from the form on the child. Then use a function in the child page to post the form on the parent page.
Thanks very much for your suggestion, but I just worked it out myself...
The trick was to name my main browser window like this:
window.name = "main";
Then from my pop-up window, to post the data back to 'main' the FORM element looks like this:
<FORM action="main.php" METHOD="POST" target="main">
It's actually a neat little effect for separating a search form (the pop-up window) from the results list (the main window).