Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/226.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 echo"<input name='type' disabled='disabled' type='text' id='type' value=$Room_type />"; ?> if(isset($_POST['type'])) { $type=$_POST['type'] } 假设您的代码是正确的,而不仅仅是您提供的,禁用的表单输入不会由浏览器提交,这就是为什么$\u POST['type']是

我从以下代码中得到一个未定义的索引错误:

<?php
  echo"<input name='type' disabled='disabled' type='text' id='type' value=$Room_type />"; 
?>


if(isset($_POST['type']))
{
   $type=$_POST['type']
}

假设您的代码是正确的,而不仅仅是您提供的,禁用的表单输入不会由浏览器提交,这就是为什么
$\u POST['type']
未定义的

这段代码完全在同一页中吗?为什么
要回显该HTML行?为什么不执行
?我已经尝试删除禁用的表单元素,但仍然会出现相同的错误。还有一些其他表单元素,它们工作正常。这是因为禁用了thanx