简体   繁体   English

在php中更改数据后返回上一页

[英]go back to the previous page after changing the data in for in php

i am trying to redirect the page to previous page after edit the form.. 编辑表单后,我试图将页面重定向到上一页。

i have these two url's for example 我有这两个网址

http://localhost/ ******/viewclientadmin.php?id=14 http:// localhost / ****** / viewclientadmin.php?id = 14

and

http://localhost/ ****/clientadminedit.php?id=106 http:// localhost / **** / clientadminedit.php?id = 106

so client after edit the form i want them to redirect to the viewclientadmin page 所以客户端编辑表格后,我希望他们重定向到viewclientadmin页面

i already tried like this 我已经尝试过了

if($DB->execute($chk_qry,$parms)) {  
 header("location:javascript://history.go(-1)");
 }

but it's not going back..it staying on same page.. 但它不会返回..它停留在同一页上..

can you please help me out..how to do that.. 你能帮我吗..怎么做..

thanks in advance... 提前致谢...

Store your url in session like this and call that variable in another page in header 像这样将您的网址存储在会话中,然后在标头的另一页中调用该变量

In your viewclientadmin.php page add these two lines 在您的viewclientadmin.php页面中添加这两行

$page = "viewclientadmin.php?id=$id";
$_SESSION['page'] = $page;

And in your clientadminedit.php page add like this 并在您的clientadminedit.php页面中添加如下内容

if($DB->execute($chk_qry,$parms)) { 

  header("Location: " . $_SESSION['page']);
}

it will work...try 它将工作...尝试

You can use 您可以使用

if($DB->execute($chk_qry,$parms)) { 
    header("Location: localhost***.php?$qry"); 
}

Instead of history.go by this way you will get your id on viewclientadmin and using that Id you will be able to fetch data from db and assign to your form. 这样,您就可以在viewclientadmin上获取id而不是history.go ,并使用该ID可以从db中获取数据并分配给表单。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM