检查URL参数是否为空的正确方法?

时间:2017-11-22 19:04:05

标签: php

当我在此处删除此代码时,代码完美无缺:

 <script>
$(document).ready(function() {
    $("#jan7").click(function(){
        alert("The button was clicked");
    });
});
</script>`

我试图说出网址(if (empty($_GET['tag'])){ header("Location: http://www.home.com"); } )是否为空,然后返回主页。 这就是搜索按钮的样子:

tag=

当我重新插入上面的代码(if (isset($_POST['submit-search'])){ $conn = mysqli_connect("localhost", "root", "", "testdb"); $search = mysqli_real_escape_string($conn, $_POST['search']); header("Location: tags?tag=".$_POST['search'].""); } )时,它会一直重定向到主页。

这是HTML:

if(empty)

0 个答案:

没有答案