Hi!
I think this would be best solved with a clientsided script.
- based upon theres a good chance the viewers browser has got it activated, but most have nowadays.
I'd do the following:
hidden fields in the form in the main page.
when the user clicks on the submit button (id take an image or someting) you dont submit but insert the values of the fields in the child document into the corresponding parent fields and close the window.
you could do the same with a layer or stylesheet btw (possibly preferable if you are using sessions);
[ if you do that be careful with old netscape's though ]
example:
//main doc
<script language=javascript>
<!--
function func_open_subwindow(){
window.open('newwindow_src.php','window_newwindow','');
}
//-->
</script>
<form>
<input type='hidden' name='field_name' value='1'>
...
<... onSomeThing="func_open_subwindow();">
<input type='submit'>
//child doc
<script language=javascript>
<!--
function func_send_stuff_back(){
for(x = 0; x < document.forms[0].length; x++){
opener.document.forms[0].elements[x].value = document.forms[0].elements[x].value;
self.close();
}
}
//-->
</script>
<form>
<input type='text' name='field_name' value='enter text'>
<a href='javascript:func_send_stuff_back();'><img src='button.jpg' border='0'>
</form>
This is the basic idea.
of course you'd have to adapt the way you call the elements.
what i'd do is give the fields the same name and id (so you can use GetElementsByName/Id and get the variables into php unchanged and give the values back to javascript/vb-script/whatever without having to mess around woth the names/ids). 2nd advantage is that you're independent of the order of the fields ... good thing once you start to change it (happens always)
Then (in the for loop):
eval("opener.document.getElementsById[\"" + document.elements[x].name + "\"].value = document.getElementsById[\""+document.elements[x].name+"\"].value;" );
Please re-check the syntax for getElementsById, im not sure i remembered it right.
And mind the differing string operator ("+") in javascript and php ( ".")
Hope this solves your problem, even if its not really php.
you get around the reload though and you can do it as often as you want without much fuss.
greetings, jakob