PDA

View Full Version : UE & VTK Looping Error


Martin
03-23-2009, 12:08 PM
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

Ray Borduin
03-23-2009, 03:21 PM
It is probably automatically appended to the form action. You could most likely remove it from the form action code and it wouldn't be passed along.

Martin
03-23-2009, 04:45 PM
So since I am specifying the anchor link in

$WAFV_Redirect = "newsletter-sign-up.php#error";

and the success e-mail redirect in

if ("newsletter-sign-up.php?success"!="") {
header("Location: newsletter-sign-up.php?success");

along with the code you asked me to update in the WAVT_Scripts_PHP.php include (so that the anchor concept would work)

http://www.webassist.com/forums/showthread.php?t=227

can I ask where I would exclude it in the form action code so it is not appended as you suggest?

Ray Borduin
03-24-2009, 07:30 AM
What is the action of the form on the page. It might not even be the problem, that is just a guess.

Martin
03-29-2009, 08:35 AM
Strange, I checked this out and tested it on the live server. It seems to be working fine now. Refreshing the page and altering the URl appropriately.

Thanks for your help. I will let you know if this occurs again.

Cheers,

Martin