设置条件的命令“ i” i' m重定向到另一页。 (PHP)

发布于 2025-02-13 04:03:18 字数 149 浏览 2 评论 0原文

我正在使用PHP 我有一个评论页面的流程表格,当您单击提交时,您将被重定向到网站的主页 当我从我的processForm.php重定向到index.php时,我想在索引中看到一个警报,即“保存了您的评论!” (它需要我的索引页面了解我来自ProcessForm.php) 我该怎么做?

I'm using php
I have a process form for a comment page that when you click on submit, you will be redirected to the main page of the website
when I redirected to index.php from my processform.php, I want to see an alert in my index that "Your comment was saved!" (It needs that my index page understand that I'm coming from processform.php)
How can I do this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

热风软妹 2025-02-20 04:03:18

您应该使用会议之类的东西。
在提交表格上设置会话。并在index.php上检查会话是否已与特殊键设置。然后显示您想要的警报。

  • 在表格上提交和成功:
// Start the session
session_start();
// Set session variables
$_SESSION["processform"] = "Your comment was saved!";

  • 在index.php上
if(isset($_SESSION["processform"]){
 // do alert
}

you should use something like sessions.
set session on submit form. and on index.php check if session has set with the special key. then show the alert that you want.

  • on form submit and success :
// Start the session
session_start();
// Set session variables
$_SESSION["processform"] = "Your comment was saved!";

  • on index.php
if(isset($_SESSION["processform"]){
 // do alert
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文