php - post isset($_POST['next'] 在提交/刷新页面后没有设置。需要按两次才能设置如何解决?
问题描述
<script>
function refreshPage()
{
document.forms[0].submit();
}
</script>
<?php
foreach($values as $value)
{
?>
<input type = "checkbox" name = "food[]" value = "<?php echo($value['dinner']);?>"
<?php if(isset($_POST['food'])) echo "checked='checked'"; ?> > // note this is still part of
input
<?php
}
?>
<button name = "pass" onClick = "refreshPage()">refresh</button>
<?php
if(isset($_POST['pass'])
{
// do a lot more stuff but I have this for temp info
echo("hello");
// I am printing all the check box values in here I do not
// have the code for it yet but I think ik how to do it
// but since i do not have code for it now it is just empty
}
?>
嗨所以每次我点击按钮刷新。isset($_POST['pass']) 不起作用。我必须单击它一秒钟才能设置它,然后打印你好和检查项目表部分。
我想要它,这样如果你点击它一次它就会打印你好。不是两次。如何修复我的代码?仅供参考,我知道你可以做 isset($_POST['food']) 让它工作。但这会破坏我代码的其他部分。
在我按下一次刷新按钮后,我需要按钮将 isset($_POST['pass']) 设置为 True(单击一次后)。
解决方案
推荐阅读
- mysql - MySQL - 加入同一个表两次但获取不同的结果
- python - 从 Python 中的特定 XML 节点检索注释
- angular - 在完成 Observer 之前等待 Array.map 完成
- google-apps-script - Google 脚本仅从 Gmail 收件箱中提取 500 封电子邮件
- java - 从 getActionProvider() 设置 ShareActionProvider 时如何解决 Null?
- java - 如何模式匹配复杂的文件路径
- tensorflow - 从 TensorFlow Estimator 模型 (2.0) 保存、加载和预测
- angular - 如何在 Angular 中获取当前的路由段(不是完整的 url)
- typescript - 为什么我需要在我的 rollup.config.js 的外部包含 https
- r - 是否可以从 xtable 中删除水平边框?