Php 将数据保存到数据库后,通过传递变量打开新表单

Php 将数据保存到数据库后,通过传递变量打开新表单,php,html,mysql,Php,Html,Mysql,我有一个表格用来更新数据库中的数据。我正在更新提交按钮上的数据,它工作正常。现在我想在数据库中更新数据后,通过向新表单传递几个变量来打开一个新表单。简而言之,我希望按钮在单击1时执行两个任务。将数据保存到数据库2。通过传递几个变量来打开新表单。我的代码是 if(isset($_POST['submit'])) { $stationerytype=$_POST['stationerytype']; $balance =$total; $sql="update tblstation

我有一个表格用来更新数据库中的数据。我正在更新提交按钮上的数据,它工作正常。现在我想在数据库中更新数据后,通过向新表单传递几个变量来打开一个新表单。简而言之,我希望按钮在单击1时执行两个任务。将数据保存到数据库2。通过传递几个变量来打开新表单。我的代码是

if(isset($_POST['submit']))
    {
$stationerytype=$_POST['stationerytype'];
$balance =$total;
$sql="update tblstationerytype set balance=:balance where stationerytype=:stationerytype";
$query = $dbh->prepare($sql);
$query->bindParam(':balance',$balance,PDO::PARAM_STR);
$query->bindParam(':stationerytype',$stationerytype[$i],PDO::PARAM_STR);
$query->execute();

$_SESSION['msg']="Stationery Added successfully";
echo "<script>window.opener.location.reload();window.close();</script>";
header(viewrequest.php?uin=<?php echo htmlentities($result->uin);?>);
if(isset($\u POST['submit']))
{
$stationerytype=$_POST['stationerytype'];
$balance=$total;
$sql=“update tblstationerytype set balance=:balance where stationerytype=:stationerytype”;
$query=$dbh->prepare($sql);
$query->bindParam(':balance',$balance,PDO::PARAM_STR);
$query->bindParam(':stationerytype',$stationerytype[$i],PDO::PARAM_STR);
$query->execute();
$\会话['msg']=“文具添加成功”;
echo“window.opener.location.reload();window.close();”;
标题(viewrequest.php?uin=);
HTML代码

<form role="form" method="post"  class="form-inline">
<input type="submit" name="submit" value="Submit" class="btn pull-right" style="margin-left:375px; margin-bottom:30px;">
</form>


你说的变量有几个?@dqureshiumar喜欢这个viewrequest.php?uin=
标题(“Location:viewrequest.php?uin=“.htmlentities($result->uin)”;
这对你有用吗?是的,现在可以工作,但是echo“window.opener.Location.reload();window.close();“现在不工作,不需要那一行