2013-05-02 74 views
0

這將在空白頁面上顯示回顯。如何在返回HTML頁面的表單提交後顯示回顯?

$existsQuery = "select count(*) as count from entry where emailaddress like '".$_POST[emailaddress]."'"; 
$existsResult = mysqli_query($con, $existsQuery); 

if($existsResult->fetch_object()->count > 0) 
{ 
    echo "email already exist"; 
    /* header('index.html?email=exists'); */ 
} 

我想在主html頁面上的提交按鈕下顯示回聲。使用URL是一種好方法,我該如何做?

回答

1

使用URL是一種好方法,我該如何做?

我認爲這是一個很好的解決方案,所以代碼應該是這樣的:

$existsQuery = "select count(*) as count from entry where emailaddress like '".$_POST[emailaddress]."'"; 
$existsResult = mysqli_query($con, $existsQuery); 

if($existsResult->fetch_object()->count > 0) 
{ 
    header('index.html?email=exists'); 
} 

,然後你可以做下面的按鈕submit按鈕,這個權利你form

<?= if (isset($_GET["email"]) && $_GET["email"] == "exists") { echo "email already exists"; } ?> 
+0

我把它切換到'header('Location:index2.html?email = exists');'所以它實際上重定向,但沒有任何顯示。我究竟做錯了什麼? :( – AndB 2013-05-02 12:50:53

+0

在頁面上添加這一行'<?= echo $ _QUERY [「email」];?>'',看看重定向時'email'的值是什麼 – 2013-05-02 12:56:36

+0

我的表單就像'

'上面的代碼在entry.php中,重定向會將您帶回index2.html?email = exists並且什麼都不顯示我錯過了像標籤或其他東西? – AndB 2013-05-02 13:11:52

相關問題