Jump to content

PHP web page/script does not redirect after email is sent


Recommended Posts

First off, please forgive the size of the web page/script that I've attached. It is a file that I got from the technical support folks at goDaddy to send emails after a user fills in the form on the web page. I was able to modify it to contain the html code needed to create the form and fit into the rest of my website. However, I have been unsuccessful in getting a redirect to work after the email is sent. I have posted other requests for help and tried what was suggested and/or found independently on the web. As a result, I've tried (apparently) most of the proposed solutions. I'm now attaching the full page because none of the recommended solutions have worked. The php script is using PHPMailer to send the email, and I am beginning to think my problems are related to those portions of the script. I am relatively new to php so, while I can read the code and work through its logic, I don't have the tools or expertise to debug the script. I would appreciate any help in figuring this out. Thank you in advance for the help.


Link to comment
Share on other sites

the ~3500 lines of phpmailer code should not be in-line in your file. they should be in external file(s) that get required by the main file.

i see that you have hard-coded the to: and subject: values in the code. these and the still present 'sendmethod' should have never come from the form. i recommend that you delete any remaining logic using the 'sendmethod' value.

this code is using ajax to submit the form data, therefore nothing the server-side post method processing code does to try to redirect will have any effect on the form page. it would take javascript code in the ajax completion code ( if ( request.readyState==4 ) { ) to test a value returned to it by the server-side code to either display a message or take an action, such as redirecting to a different page.


Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.