2010-08-14 184 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