代码之家  ›  专栏  ›  技术社区  ›  user225269

如何正确检查HTML文本框是否为空

php
  •  0
  • user225269  · 技术社区  · 14 年前

    当我在wampserver上运行这个命令时,总是会收到未定义的索引通知。试着做一些 research 在去这里之前,我把代码集成到这里,但仍然没有运气。请帮忙。

    <?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 回复  |  直到 14 年前
        1
  •  1
  •   Bang Dao    14 年前

    在第一行

    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