Home >Backend Development >PHP Tutorial >PHP关于REQUEST一点有关问题

PHP关于REQUEST一点有关问题

WBOY
WBOYOriginal
2016-06-13 12:08:52899browse

PHP关于REQUEST一点问题
   $doing=$_REQUEST['doing'];

   switch($doing)
  {
      case "yingwen":
             
                  if(isset($_REQUEST['english']))
                {        echo"别出来了";
 }  else
                       { echo "请输入英文";} 
                            break;      
          
      case "zhongwen":
                          
if(isset($_REQUEST['chinese']))
                {        echo"别出来了";
 }  else
                       { echo "请输入中文";} 
                            break;
   
                        
  }         
?>
——————————————————————————————————————————————————————


在线词典



查询中文:




查询英文:





——————————————————————————————————————————————————————
我现在的困惑时我什么都没有填写,只点击提交按钮 PHP也能接收到数据,输出“别出来了”这是为什么?我判断了啊,如果没有接收到数据就输出else,可是为什么他永远不会执行呢?
------解决思路----------------------
表单控件 nput type="text" 无论是否有值,都会被提交
提交后当然就是已定义了

if(isset($_REQUEST['english'])) 应改为
if(! empty($_REQUEST['english']))
其他类同

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