子ページを呼び出してフォームを投稿しています。子ページに入力された値に基づいて、親ページを更新して再構築しようとしています。親ページに子が投稿した値が表示されません。
子が親ページから送信されると、期待値 $_POST['test_2'] が入力されます。子ページによって投稿された値が親ページに表示されません。以下のコード例を参照してください。助けてくれてありがとう。
親ページ: Example1Parent.php
<html>
<head>
<body>
<h1> Welcome Parent </h1>
<div id="dateDiv"></div>
<form method=post action='' name=f1>
<table border=0 cellpadding=0 cellspacing=0 width=550>
<tr>
<td ><font size=2 face='Verdana'>Refresh upon Search</font>
<input type=hidden name='p_name2' id=n2 size='8'>
<input type=button
onClick=window.open("Example1Child.php","Ratting","width=550,height=170,left=150,top=200,toolbar=0,status=0,"); value="Advanced Search">
<?php
echo '<br> Welcome ';
if (!isset($_POST['test_2'])) echo "<br> t_test2 : it does not exists! ";
?>
</td></tr>
</table>
</form>
</body>
</html>
子ページは :Example1Child.php
<html>
<head>
<title>ChildForm</title>
<SCRIPT language=JavaScript>
<!--
function win(){
window.opener.location.href="Example1Parent.php";
self.close();
//-->
}
</SCRIPT>
</head>
<body>
<h1> Welcome to Child </h1>
<form name="child" id="child" METHOD="POST" action=''>
<input type="text" id="test_2" name="test_2" value="ENTER DATA TO PARENT PAGE">
<INPUT TYPE="SUBMIT" onClick="win();" value="SEND VALUE TO PARENT">
</form>
</body>
</html>