2012-08-23 7 views
1

안녕하세요 모두가 PHP를 처음 접했고 데이터베이스의 데이터가 들어있는 데이터 창이있는 하위 창에서 데이터를 전달할 수 있는지 그리고 어떤 데이터를 선택했는지 알고 싶습니다. 하위 창 내의 체크 박스를 사용하여 부모 창의 텍스트 영역에 값을 표시합니다. 누군가가이 문제에 대해 도움을 주면 감사하겠습니다. 아래는 코드입니다. 감사.PHP는 자식 창에서 부모 창에 데이터를 전달합니다

자식 창 :

<head> 
    <!-- CSS goes in the document HEAD or added to your external stylesheet --> 
<!-- CSS goes in the document HEAD or added to your external stylesheet --> 
<style type="text/css"> 
table.hovertable { 
    font-family: verdana,arial,sans-serif; 
    font-size:11px; 
    color:#333333; 
    border-width: 1px; 
    border-color: #999999; 
    border-collapse: collapse; 
} 
table.hovertable th { 
    background-color:#c3dde0; 
    border-width: 1px; 
    padding: 8px; 
    border-style: solid; 
    border-color: #a9c6c9; 
} 
table.hovertable tr { 
    background-color:#d4e3e5; 
} 
table.hovertable td { 
    border-width: 1px; 
    padding: 8px; 
    border-style: solid; 
    border-color: #a9c6c9; 
} 
</style> 

<!-- Table goes in the document BODY --> 

</head> 
<body> 
     <form action="retrievemath.php" method="post"> 
<table class="hovertable"> 
<tr> 
    <th>Insert ?</th><th>Expression Name</th><th>Math Expression</th> 
</tr> 
<tr onmouseover="this.style.backgroundColor='#ffff66';" onmouseout="this.style.backgroundColor='#d4e3e5';"> 

</tr> 

    <?php 
       while($row = mysql_fetch_assoc($queryResource)) 
       {  
    ?> 

        <tr> 
        <td><input type="radio" name="insert" id="<?php echo $row['mathID']?>" value="<?php echo $row['expressionname']?>" /> </td> 
        <td><?php echo $row['expressionname']; ?></td> 
        <td><?php echo $row['mathexpression']; ?></td> 
        </tr> 

    <?php 
       } 
    ?> 


</table> 



    <div class="submit"> 
    <input type="hidden" name="formsubmitted" value="TRUE" /> 
     <input type="submit" value="Insert" /> 
    </div> 
     </form> 
</body> 
<?php 
if (isset($_POST['formsubmitted'])) { 
    echo $_POST['insert']; 
} 
?> 

부모 창 :

<head> 
<script type="text/javascript"> 
<!-- 
function myPopup2() { 
window.open("retrievemath.php", "myWindow", 
"status = 1, height = 300, width = 300, resizable = 0") 
} 
//--> 
</script> 
<script src="ckeditor/ckeditor.js"></script> 

</head> 
<body> 
    <textarea class="ckeditor" cols="80" id="editor1" name="editor1" rows="10" ></textarea> 
<form> 
<input type="button" onClick="myPopup2()" value="POP2!"> 
</form> 
<p onClick="myPopup2()">CLICK ME TOO!</p> 
</body> 

답변

1

당신의 부모 윈도우가 "window.opener"here 당신이에 아이에서 데이터를 전송하는 방법을 예입니다 액세스 할 수 있습니다 부모 창.

+0

대단히 감사합니다. 나는 이것을 조사 할 것이다. – user1610834

관련 문제