get data from POPUP window back to Parent(SMARTY)

2k views Asked by At

my popup gets data from Database where the user can chose from. now can somone explain me how i can get submitted data(array) from my popup window back to my PARENT Form and after that back to "PARENT PHP" ?:X

i already found a way using

window.opener.document.forms.form_id.inputname.value

or

window.opener.document.getElementById('inputname').value

but i dont really know what to do with it and how to make it work for me.

Parent form:

<form method="POST" name="big_form">

popupcode in PARENT:

function popup(Location,w,h) //opens new window
{
  var options = "width=" + w + ",height=" + h;
  options += ",menubar=no,location=no,resizable=0,scrollbars,top=500,left=500";

  var newwin = window.open(Location,'newWin',options);

  if (newwin == null)
  {
    // The popup got blocked, notify the user
    return false;
  }

  newwin.focus();

}

<input class="myButton" onclick="popup('?n=popup_arbeitsplatz','800','800');" style='font: bold 10px Arial;height:25px;
        padding: 2px 6px 2px 6px;
        width:25px;' value="A"  type="button" />

after chosing data he is then supposed to save(submit) and close the popup. now the data is not supposed to show up in the PARENT directly in some way. i only need it stored somewhere and be able to manipulate the data in my PARENTS PHP. i tried many things like saving in session or including in my PARENTS PHP and tried to get the data with $_POST whatsoever.. nothing worked.

maybe something else then window.opener i dont really care i just want my data somehow :D.

2

There are 2 answers

0
the_X On BEST ANSWER

use the $_SESSION['yourVarName'] to save your submit

1
Borgtex On

Put an input type="hidden" in the parent form and before closing the popup, populate with javascript that input with the values you selected in the popup