gpt4 book ai didi

javascript - 邮件订阅成功弹出表单

转载 作者:行者123 更新时间:2023-11-28 03:23:31 26 4
gpt4 key购买 nike

我正在尝试弄清楚如何从这个现有的订阅表单修改脚本:

HTML

<form method="post" action="subscribe.php">
<input type="text" name="email"/>
<input type="submit" value="Submit" class="submit-btn">
<input type="hidden" name="success" value="test-success.html">
<input type="hidden" name="error" value="test-error.html">
</form>

PHP

    if (preg_match('/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$/', $email))
{
if ($result && !empty($successUrl))
{
header( "Location: $successUrl") ;
}
else if (!empty($errorUrl))
{
header( "Location: $errorUrl") ;
}
else
{
echo 'Error';
}
}
else if (!empty($errorUrl))
{
header( "Location: $errorUrl") ;
}
else
{
echo 'Error';
}

exit();
}
?>

我不想重定向到成功/错误页面,而是想通过弹出窗口显示消息。

我使用的弹出窗口是 Magnific Popup。

http://dimsemenov.com/plugins/magnific-popup/documentation.html

我已尝试编辑输入类型的值并添加到弹出链接中,但它无法正常工作。我也不擅长 php 脚本,我可以知道我应该如何让它工作吗?

最佳答案

您可以使用 native Javascript 警告框来显示弹出窗口

else if (!empty($errorUrl))
{
echo "<script>alert('Error !');</script>";
echo "<script>window.location.href=$errorUrl</script>";
}

关于javascript - 邮件订阅成功弹出表单,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22709517/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com