1

我的弹出窗口从用户可以选择的数据库中获取数据。现在有人可以解释一下我如何将提交的数据(数组)从我的弹出窗口返回到我的父表单,然后返回到“父 PHP”?:X

我已经找到了一种使用方法

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

或者

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

但我真的不知道如何处理它以及如何让它为我工作。

父表格:

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

父母中的弹出代码:

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" />

选择数据后,他应该保存(提交)并关闭弹出窗口。现在数据不应该以某种方式直接显示在 PARENT 中。我只需要将它存储在某个地方并能够在我的 PARENTS PHP 中操作数据。我尝试了很多方法,例如保存会话或包含在我的 PARENTS PHP 中,并尝试使用 $_POST 获取数据。但没有任何效果。

也许还有别的东西然后window.opener我真的不在乎我只是想要我的数据以某种方式:D。

4

2 回答 2

1

使用$_SESSION['yourVarName']保存您的提交

于 2013-12-11T14:26:55.610 回答
0

在父表单中输入 type="hidden" 并在关闭弹出窗口之前,使用您在弹出窗口中选择的值输入的 javascript 填充

于 2013-12-11T10:39:33.870 回答