UE & VTK Looping Error
Greetings! I have been working with UE & the VTK to create a form that validates itself, jumps to the error on the page, shows conditional validations and when successfully validated sends an e-mail by UE that then redirects back to the page and displays a hidden success message.
I am currently running into an error that I don't know is caused by either VTK or UE.
So when the page URL refreshes on an error it shows like this:
newsletter-sign-up.php#error
When UE successfully sends an e-mail it should show up like this in the URL:
newsletter-sign-up.php?success
which then displays the hidden success message because of the get - success from the URL.
However what I am getting is the following:
newsletter-sign-up.php?success#error
and the e-mail is putting itself into a loop and sending out multiple e-mails...
So it looks like when the e-mail is being successfully sent it is not refreshing the URL and deleting the #error message.
Here is my header
<?php require_once('WA_Globals/WA_Globals.php');?>
<?php require_once("WA_ValidationToolkit/WAVT_Scripts_PHP.php"); ?>
<?php require_once("WA_ValidationToolkit/WAVT_ValidatedForm_PHP.php"); ?>
<?php
if ((((isset($_POST["submit"]))?$_POST["submit"]:"") != "")) {
$WAFV_Redirect = "newsletter-sign-up.php#error";
$_SESSION['WAVT_newslettersignup_Errors'] = "";
if ($WAFV_Redirect == "") {
$WAFV_Redirect = $_SERVER["PHP_SELF"];
}
$WAFV_Errors = "";
$WAFV_Errors .= WAValidateEM(((isset($_POST["email"]))?$_POST["email"]:"") . "",true,1);
$WAFV_Errors .= WAValidateLE(((isset($_POST["Security_code"]))?strtolower($_POST["Security_code"]):"") . "",((isset($_SESSION["captcha_1"]))?strtolower($_SESSION["captcha_1"]):"") . "",true,2);
if ($WAFV_Errors != "") {
PostResult($WAFV_Redirect,$WAFV_Errors,"newslettersignup");
}
}
?>
<?php require_once("WA_Universal_Email/mail_PHP.php"); ?>
<?php require_once("WA_Universal_Email/MailFormatting_PHP.php"); ?>
<?php
if (((((isset($_POST["submit"]))?$_POST["submit"]:"") != ""))) {
//WA Universal Email object="mail"
//Send Loop Once Per Entry
//Send Mail All Entries
$RecipientEmail = false;include("WA_Universal_Email/WAUE_newsletter-sign-up_1.php");
if ("newsletter-sign-up.php?success"!="") {
header("Location: newsletter-sign-up.php?success");
}
}
?>
Any help would be appreciated!
FYI, if they fill out the form correctly the first time, it works fine and displays ?success. It is only when we have an error that I run into this problem.
Thanks!
Martin