php - 如何从验证表单中获取可用的 ID?
问题描述
当表单在其中一个页面上使用验证时,如何调用现有 ID?所以当用户输入的数据无效时,页面仍然填充相同的数据...
我有process.php文件:
header('Location:/directory/process.php?existing id=existing id');
和form.php文件,我尝试获取存在的 id:
if(isset($_GET['existing id'])){
if($_GET['existing id'] == 'existing id'){
echo "<center><font style='color : red ; font-size:17px;'><b>Invalid.</b></font></center><br>";
}
}
当我尝试编辑其中一个无效数据时,它会显示页面,但页面中没有显示现有数据....
解决方案
变量名之间不应有任何空格。所以existing id
应该是existingid
或existing_id
或existingId
或类似的东西
process.php文件应该是
header('Location:/directory/process.php?existingid=existing id');
表单.php
if(isset($_GET['existingid'])){
print_r($_GET);
if($_GET['existingid'] == 'existing id'){
echo "<center><font style='color : red ; font-size:17px;'><b>Invalid.</b></font></center><br>";
}
}
推荐阅读
- python - 在 Django Rest Framework 中对来自我的网站的 Ajax 请求进行权限绕过
- typescript - 是什么导致 Jest 在此代码中显示 75% 的分支覆盖率?
- mdx - mondrian.olap.ResourceLimitExceededException:蒙德里安错误:要读取的成员数超出限制(10,000)
- java - 为什么我的 android studio EditText 视图不显示输入、输出或提示?
- javascript - 简单的 VueJS Hello world 应用程序不工作
- android - 注入到 Hilt 未实例化的任意 Logic 类中
- mysql - 在mysql中的两列无序对中提取重复项
- list - 过滤列表的飞镖等效函数是什么?
- crash - Blender 在打开着色器编辑器时崩溃
- android - 卷曲到 android 凌空转换