javascript - 提交前查看联系表
问题描述
需要帮助...我希望人们在单独的页面上查看他们的表单输入,然后从第二页确认他们的提交,我该怎么做?
// 索引页面
<form action="confirm.php" method="post">
<input type="text" name="uname">
<input type="submit" value="next">
</form>
<?php
$name = $_POST["uname"];
echo('
<form action="submit.php" action="post">
// trying to prefill the form so that on submit the values are sent to submit.php
<input value=$name name="username"> // setting the value to be captured in the next form = php variable $name
<input type="submit" value="next">
</form>
'
)
?>
解决方案
您需要将预览数据保存在会话中。这只是根据您的要求的一个示例。
<form action="" method="post">
<input type="text" name="uname">
<input type="submit" value="next">
</form>
<?php
error_reporting(0);
session_start();
$name='';
$uname='';
$name = $_POST["uname"];
echo $_SESSION['uname'] = $name;
if($_SESSION['uname'] !=''){
?>
<form action="submit.php" action="post">
<input type="text" value="<?php echo $_SESSION['uname']; ?>" name="username">
<input type="submit" value="next">
</form>
<?php
}
?>
推荐阅读
- php - 使用 mo 文件在 WordPress 主题中翻译包括超链接的文本的问题
- arrays - 在 Google 表格中,是否有 MATCH 或 INDEX 公式可以显示多个匹配的单元格?[提供示例]
- c - 错误:找不到 ELF 基地!- 返回到 libc
- vulkan - VkSubpassdependencies 是否仅对渲染通道中的子通道有用?
- excel - 如何使用服务帐户从外部数据源刷新 Excel 电源查询
- loops - Stata Loop 对三个单独的 dta 文件执行一系列操作
- reactjs - Redux 工具包和 createAsyncThunk 不适用于 axios 实例
- r - 如何在 r 的列表中找到最大值的 ijk 索引?
- .net - EF Core 将导航属性存储在同一个表中
- docker - docker mediawiki ,未连接到数据库