Home > Backend Development > PHP Tutorial > 当小弟我留言结束后,点击一个alert返回前一页

当小弟我留言结束后,点击一个alert返回前一页

WBOY
Release: 2016-06-13 12:03:50
Original
1786 people have browsed it

当我留言结束后,点击一个alert返回前一页
$data['univ_name']=$id;
$data['user_name']=$user_name;
$data['user_comment']=$_POST['user_comment'];
$data['user_comment_good']=$score;
$data['user_comment_money']=$_POST['user_comment_money'];
$data['user_comment_date']=$_POST['user_comment_date'];
$User->add($data);
$result = $User->select ();
$this->success("留言成功");
}
$this->user_state = $user_state;
$this->display();
这是一段留言代码,当我成功时候 $this->success("留言成功"); 它会跳出来一个页面,这个页面不好看,
现在我想跳出一个alert 或者跳转页面也行,但是当我点击alert的确定按钮时候我希望它能够返回到我写留言的那页
准确说就是我想获取success的URL 让我的alert也能实现回去前一页的效果  请问要怎么做好? 最好有个代码什么的 如果大家说的我不明白 我还能研究一下代码。。
------解决方案--------------------
$this->success("留言成功");
改為

<br />echo '<script type="text/javascript">'."\r\n";<br />echo 'alert("留言成功");'."\r\n";<br />echo 'window.history.go(-1);'."\r\n";<br />echo '</script>';<br />
Copy after login

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template