2010-08-14 186 views
0

当我在wampserver上运行此操作时,我总是会收到未定义的索引通知。在去这里之前试过做了一些research,我把代码整合到这里,但仍然没有运气。请帮忙。如何正确检查html文本框是否为空

<?php 
    if(!empty($_GET['lurl']) || ($_GET['lclass']) || ($_GET['lnotes'])) { 

    $url=$_GET['lurl']; 
    $clas=$_GET['lclass']; 
    $notez=$_GET['lnotes']; 



    $sql="CALL geturl('$url')"; 
    $result1=mysql_query($sql); 

    ?> 

       <center> 

    <table border="1"> 

    <thead> 
     <tr> 
     <th>URL</th> 
     <th>CLASS</th> 
     <th>NOTES</th> 
     </tr> 
    </thead> 


    <?php 
    while($row=mysql_fetch_assoc($result1)){ 


    ?> 


     <tbody> 
       <tr> 
      <td><?php echo $row['URL']; ?></td> 
      <td><?php echo $row['Class']; ?></td> 
      <td><?php echo $row['Notes']; ?></td> 

       </tr> 
      </tbody> 

    <?php } ?> 
    <?php } ?> 

回答

1

在1号线

if(!empty($_GET['lurl']) || ($_GET['lclass']) || ($_GET['lnotes'])) 

必须为空函数

if(!empty($_GET['lurl']) || !empty($_GET['lclass']) || !empty($_GET['lnotes'])) 

参考http://php.net/manual/en/function.empty.php

+0

我还是得到了一个未定义指数的通知时,我用这个 – user225269 2010-08-14 07:20:59