2013-05-02 157 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

相关问题