gpt4 book ai didi

PHP从子窗口向父窗口传递数据

转载 作者:行者123 更新时间:2023-11-28 02:44:39 26 4
gpt4 key购买 nike

大家好,我是 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>

最佳答案

您的父窗口可以通过“window.opener”访问 here是如何将数据从子窗口发送到父窗口的示例。

关于PHP从子窗口向父窗口传递数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12092851/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com