从子项传递值并使用子页面输入重建父页面

时间:2013-02-03 16:55:20

标签: php javascript

我正在调用子页面并发布表单。尝试根据在子页面中输入的值刷新和重建父页面。我无法在子页面中看到子项已发布值。

期望值$ _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>

0 个答案:

没有答案