DanS Posted July 3, 2022 Share Posted July 3, 2022 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. contact.txt Quote Link to comment https://forums.phpfreaks.com/topic/314992-php-web-pagescript-does-not-redirect-after-email-is-sent/ Share on other sites More sharing options...
mac_gyver Posted July 3, 2022 Share Posted July 3, 2022 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. Quote Link to comment https://forums.phpfreaks.com/topic/314992-php-web-pagescript-does-not-redirect-after-email-is-sent/#findComment-1597909 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.