我想在子页面完成由提交按钮触发的一些处理后刷新父页面上的 div,然后关闭子窗口。欢迎任何想法。
用于打开子页面的脚本 parent.php :
$(function(){
$('#right').on({
click: function(){
window.open('child.php', 'Delivery choice', 'width=600,height=600');
}
},'.ship');
});
这是 child.php :
<?php session_start(); ?>
<div style="background: transparent url(images/bg2.png) repeat-y scroll 0% 50%;"><form action="deliverydata.php" method="post" enctype="multipart/form-data">
<table border="1">
<tr><th>Code</th><th>Service de livraison</th><th>Prix</th><th>Delais de livraison</th><th>Choisir</th></tr>
<?php
function connectMaBase(){
$base = mysql_connect ('localhost', 'root', '');
mysql_select_db ('artisant', $base) ;
}
connectMaBase();
$sql ='SELECT * from categ_livraison';
$res = mysql_query ($sql) or die ('Erreur SQL !'.$sql.'<br />'.mysql_error());
while (($row = mysql_fetch_array($res)) != null)
{
echo '<tr><td>'.$row['num_categ_livraison'].'</td><td>'.$row['designation'].'</td><td>'.$row['frais'].'</td><td>'.$row['jours'].'</td><td><input type="radio" name="deli" value="'.$row['num_categ_livraison'].'"/></td></tr>';
}
echo '</table><div style="padding: right; margin: 40px 100px 100px 375px;"><input type="submit" name="valider" value=" OK " /></div></form></div>';
mysql_close();
if (isset($_POST['valider'])){
connectMaBase();
$sql = 'UPDATE produit SET categorie_livraison ="'.$_POST['deli'].'" WHERE num_prod='.$_SESSION['num_prod'];
$res = mysql_query ($sql) or die ('Erreur SQL !'.$sql.'<br />'.mysql_error());
mysql_close();
echo "<script>window.close();</script>";}
?>