PDA

View Full Version : Form not re-directing to thank you


conmolbry
04-02-2009, 04:35 PM
I have created a form from the solution pack. On my remote server it operates fine and re-directs to the thank you page after submitting the completed form. I've set up a local testing server on my computer using the xampp for windows (I have xp pro) which installs Apache, PHP, and MySQL. Everything seems to be running fine there but when I bring up the form page in the local server, then submit it seems to just refresh the form page with blank fields rather than submitting and re-directing to the thank you page. Any thoughts on what I might look for to make this work on the local server like it does so well on the remote one? Any help is really appreciated.
Peter

Ray Borduin
04-02-2009, 04:41 PM
Probably a local firewall preventing the referral checking. You can update the IF statement and remove the referral checking portion...

in other words update:


if ((($_SERVER["REQUEST_METHOD"] == "POST") && (isset($_SERVER["HTTP_REFERER"]) && strpos(urldecode($_SERVER["HTTP_REFERER"]), urldecode($_SERVER["SERVER_NAME"].$_SERVER["PHP_SELF"])) > 0) && isset($_POST))) {

and make it:
if ($_SERVER["REQUEST_METHOD"] == "POST") {

conmolbry
04-02-2009, 05:06 PM
Ray unless I'm looking in all the wrong places, the existing code seems to match your solution already. Here's an excerpt from the php code early in the file with the relevant line right after the opening tag:

<?php
if ($_SERVER["REQUEST_METHOD"] == "POST") {
//WA Universal Email object="Mail for Linux"
//Send Loop Once Per Entry
$RecipientEmail = "".($WAGLOBAL_Email_To) ."";include("WA_Universal_Email/WAUE_contact_1.php");

//Send Mail All Entries
if ("index.php"!="") {
header("Location: thankyou.php");
}
}
?>

I'm a real neophyte with php code so I don't know for sure if I'm looking in the right place. What do you think?

One interesting twist: I thought I could just shut down my zonealarm (firewall) and problem solved. It actually did have some effect. The page didn't re-direct but the entries for the contact and message boxes remained. the captcha and random ? entries were gone. So different, but not yet fixed. Why would it not work to just shut down my firewall if that was the problem. It seems like a more straightforward thing for me to do when using the local server for testing. Rather than have to edit code... and know which code to edit.

Ray Borduin
04-03-2009, 07:26 AM
It looks like it is updated. Turning off the firewall is of course an option. The captcha and random question entries are supposed to be gone, since they change each time there is no benefit to keeping them.

conmolbry
04-03-2009, 08:00 AM
Thanks for the confirmation. My issue remains unresolved however and we seem to be back to square one. That is, the form is not functioning properly using a local testing server in that it is not re-directing to the thank you page. The testing server itself seems to be operating just fine. Do you have any suggestions for a plan B, tech support, or anything else I might try?
Peter

Ray Borduin
04-03-2009, 08:50 AM
If you move the redirect to the first line of code on the page will it redirect:

<?php
header("Location: thankyou.php");
die();
?>

my guess is there is another error before the redirect preventing it from being successful. By starting on the first line and moving it down, you may be able to determine where the problem begins and then how to fix it.
If not

conmolbry
04-03-2009, 12:22 PM
OK your code looks a little different. I don't have the "die" thing. I copied your code into that first line and the browser went directly to the thank you page. When I put the code anywhere else in that block, it goes to the contact form page and doesn't re-direct. Is there a next step to try?

Ray Borduin
04-03-2009, 02:11 PM
Do you have spaces or a blank line on top of the document?

conmolbry
04-03-2009, 05:22 PM
Aaaarrgghh this is where this form of communication can get pretty inefficient. Not that I don't appreciate you hanging in there with me. If you mean the contactus.php file, there is nothing but code all the way up to the top. No spaces or blank lines. If you mean something else, please be more specific.

Ray Borduin
04-06-2009, 07:06 AM
You should post a support incident. That will allow you to share files and speak over the phone with a webasisst engineer.

If a line of code works on the first line and not on the second, then something on the first line is causing the problem. If you can't debug php, then you will probably need someone who can to help directly.

conmolbry
04-07-2009, 07:59 AM
OK I'll check with support. MY conclusion is that since I followed all of the instructions to the letter, there is something flaky in the code for the solution pack file (which I have not edited). My local server is working just fine otherwise.