+ -
当前位置:首页 → 问答吧 → 请帮忙看一下这个查询页面问题出在哪里了,谢谢

请帮忙看一下这个查询页面问题出在哪里了,谢谢

时间:2011-11-21

来源:互联网

PHP code
]
<?php 
include "../Conn/conn.php";
?>
<body>
                      <form  name="myform" method="post" action=""> 
                              <table width="560" border="1" cellpadding="3" cellspacing="1" bordercolor="#D6E7A5" align="center"> 
                              <tr> 
                                <td width="100%" height="28" align="center">查询条件:
                                  <select name="sel_tj" id="sel_tj"> 
                                    <option value="name" selected>姓名</option> 
                                    <option value="phone">号码</option> 
                                  </select> 
                                  关键字
                                  <input name="sel_key" type="text" id="sel_key" size="30"> 
&nbsp; 
                                  <input type="submit" name="Submit" value="检索" ></td> 
                              </tr> 
                            </table>
                          </form>
                      
                    <?php
                  if ($_POST["submit"]=="检索"){
                       $tj=$_POST[sel_tj];
                     $key=$_POST[sel_key];
                     $sql=mysql_query("select * from tb_pbook where $tj='$key'");
                     $result=mysql_fetch_array($sql);
                           
                 ?> 
                
<table width="560" border="1" cellpadding="3" cellspacing="0" align="center" bordercolor="#D6E7A5">
  <tr>
    <td colspan="2"><strong>查询结果:</strong></td>
  </tr>
  <tr>
    <td width="30%"><strong>姓名</strong></td>
    <td><strong>电话号码</strong></td>
  </tr>
  <?php 
  if($result==false){
                      echo ("[<font color=red>Sorry!没有您要找的朋友!</font>]");
                  }        
  else{
      ?>
  <tr>
    <td><?php echo $result[name]; ?></td>
    <td><?php echo $result[phone];?></td>
  </tr>
</table>
<?php
                  }
                  }                  ?>
</body>

作者: belin520   发布时间: 2011-11-21

什么问题?

作者: kyzy_yy_pm   发布时间: 2011-11-21

没问题,不能正常查找,而且貌似语句只执行到第一个if就停止了,连下面的table也不显示了
引用 1 楼 kyzy_yy_pm 的回复:
什么问题?

作者: belin520   发布时间: 2011-11-21

$_POST["Submit"]

作者: kyzy_yy_pm   发布时间: 2011-11-21

相关阅读 更多