首页 > 解决方案 > 如何从验证表单中获取可用的 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>";
        }
    }

当我尝试编辑其中一个无效数据时,它会显示页面,但页面中没有显示现有数据....

标签: php

解决方案


变量名之间不应有任何空格。所以existing id应该是existingidexisting_idexistingId或类似的东西

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>";
        }
    }
  

推荐阅读