php - 表单、PHP(自制)函数和刷新页面的怪异行为
问题描述
我的 PHP 脚本中有一个表单,它只有一个提交按钮。单击它会刷新页面并调用我创建的函数。在函数之前,我正在回显一些文本,但它没有显示文本并转到函数并首先完成它(可能需要 10 到 20 秒)。屏幕上显示的只是按下的提交按钮。
我还有几个其他函数,它们是从以前的函数调用的,它们前面也有文本,但同样的,在所有函数完成它们正在做的事情之后,所有文本都会显示出来。
我只是不希望用户单击认为什么都没有发生的事情,因此文本只是该过程正在运行的简介。
我错过了什么吗?这是 PHP 还是表单的东西。
谢谢
<?php
if(isset($_POST["section"]) && $_POST["section"] == "Install") {
echo "<p class='install'>Working.......<br></p>";
Database($db);
}
else {
echo "<p class='install'>Welcome to IMS setup. Please follow the instructions and enter any information as requested for a smooth installation. If you haven't done so already edit lines 4, 5 and 6 of this file to
match your MySQL login credentials. DO NOT change any other setting in this file. Click Install when you are ready to start.</p>
<p>
<form action='install.php' method='post'>
<input type='submit' name='section' class='button button-primary' style='width: 12%' value='Install'>
</form>
</p>";
}
function Database($db) {
echo "In Progress";
create DB and Tables code
Populate($db);
}
填充($db){
echo "In Progress";
Enter stuff in the tables.
next table etc.
} ?>
解决方案
推荐阅读
- android - Android - 使用 PackageInstaller 和 PackageInstaller.Session 静默安装 APK
- r - 使用 R 数据表计算 Max Row 时避免 NA
- .net - 如何在执行 LINQ 查询时更改架构名称?
- c# - Google Sheets C# API - 将行插入工作表时“执行请求失败”
- autohotkey - 如何增加我在自动热键循环中按下的选项卡数量?
- java - 使用 iText 合并 PDF 时的类似字段
- json - 如何使用 axios 钻入 json 数组
- c - 如何将局部结构传递给函数?
- windows - 猎鹰(女服务员)教程模块对象不可调用
- sql - 希望优化此查询