Home  >  Article  >  Backend Development  >  出现Notice: Undefined index:该如何处理

出现Notice: Undefined index:该如何处理

WBOY
WBOYOriginal
2016-06-13 13:42:371057browse

出现Notice: Undefined index:
我在searchroom.php中将值提交给selectroom.php进行处理,总是出现Notice: Undefined index:
searchroom.php
 


  Room Type:
 
 
  Room Price:
 
 
 
 

selectroom.php
 

  $roomtype=$_POST["selecttype"];
$roomprice= $_POST["pricerange"];
  echo $roomtype;

红色部分是出错的地方,我想知道为什么得不到$_POST["selecttype"]和$_POST["pricerange"]呢?
  echo $roomprice;
  ?>
 


------解决方案--------------------

------解决方案--------------------
必须的。
http://www.w3school.com.cn/tags/att_input_name.asp
------解决方案--------------------
在置顶的常见问题里有提到这是一个提示.

加上
if (isset($_POST['selecttype']))
$roomtype=$_POST["selecttype"];

另外如t5500所述修改.否则你取不到值
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn