dongzhi6463 2014-06-25 20:49
浏览 37

PHP响应。 第二个isset()调用不起作用

I have a simple PHP code that queries the DB and returns a list, which includes a new <kbd>submit</kbd> button, that will approve or not that post.

 if(isset($_POST['search'])){

while($row = mysqli_fetch_array($select)) {
  if($row['flag']==0) {
    echo "<br>";
    echo "<div class=\"dlcontainer2\">"; 
    echo "<div class=\"dlitem\">"; 
    echo "TourID: ";
    echo "<div class=\"dltourID\">{$row['tourID']}</div>"; 
    echo "Title: ";
    echo "<div class=\"dltitle\">{$row['title']}</div>"; 
    echo "City: ";
    echo "<div class=\"dlcity\">{$row['city']}</div>";
    echo "Description: ";
        echo "<div class=\"dldescription\">{$row['description']}</div>"; 
    //echo "<div class=\"dlapprove\">;
    echo "<input class=approve type='submit' name='submit' id=approve value='Approve'>"; 
    echo "</div>"; 
    echo "</div>"; 
    echo "<br>";

  }
}
}

And just below that, I make another isset() to see if the user clicks on the <kbd>Approve</kbd> button or not. But it is doing nothing:

if(isset($_POST['submit']) && !empty($_POST)) {
    echo "<script type='text/javascript'>alert('$message');</script>";
} else{
    echo "No true";
}
  • 写回答

2条回答 默认 最新

  • doudi8829 2014-06-25 21:00
    关注

    I think your problem isn't the isset() but the !empty($_POST) I don't believe that $_POST on it's own returns anything.

    Instead maybe try using !empty($_POST['submit']) which does what it looks like your code is trying to do.

    评论

报告相同问题?

悬赏问题

  • ¥15 (标签-UDP|关键词-client)
  • ¥15 关于库卡officelite无法与虚拟机通讯的问题
  • ¥15 qgcomp混合物线性模型分析的代码出现错误:Model aliasing occurred
  • ¥100 已有python代码,要求做成可执行程序,程序设计内容不多
  • ¥15 目标检测项目无法读取视频
  • ¥15 GEO datasets中基因芯片数据仅仅提供了normalized signal如何进行差异分析
  • ¥100 求采集电商背景音乐的方法
  • ¥15 数学建模竞赛求指导帮助
  • ¥15 STM32控制MAX7219问题求解答
  • ¥20 在本地部署CHATRWKV时遇到了AttributeError: 'str' object has no attribute 'requires_grad'