Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/299.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
我们如何用PHP中的隐藏字段替换已发布的值_Php - Fatal编程技术网

我们如何用PHP中的隐藏字段替换已发布的值

我们如何用PHP中的隐藏字段替换已发布的值,php,Php,我在表单(php)中有两个隐藏字段,这些隐藏字段将被替换 这些隐藏字段的值来自两个文本框。 因此,我们直接从动作表单中的文本框中获取值 <input type ="text1" name="text1" value=""> <input type ="text2" name="text2" value=""> <?php if(!empty($_POST['text1'])){ $fromvalue ="somevalue"; }else{ $fr

我在表单(php)中有两个隐藏字段,这些隐藏字段将被替换 这些隐藏字段的值来自两个文本框。 因此,我们直接从动作表单中的文本框中获取值

<input type ="text1" name="text1" value="">
<input type ="text2" name="text2" value="">

<?php

if(!empty($_POST['text1'])){
    $fromvalue ="somevalue";
}else{
   $fromvalue ="somevalue";
}

if(!empty($_POST['text2'])){
    $tovalue ="somevalue";
}else{
    $tovalue ="somevalue";
}

?>

如果您提交表单,
type=“hidden”
的任何输入也会被提交,只要它们的
名称设置为
字段即可。您应该能够完全按照显示方式访问您提交到的任何页面中的值:
$\u POST['inputName']

仅供参考,我不使用隐藏字段,我应该删除隐藏字段,并使用名为$from value和$tovalue的文本框值
if(strlen($fromValue) == 4){
        $qry .= " and CVDT >= $fromvalue";
    }

if(strlen($tovalue) == 4){
        $qry .= " and CVDT <= $tovalue";
    }