barryhayden Posted February 7, 2010 Share Posted February 7, 2010 I have a form page (I was supplied with) created in Dreamweaver which uses a php script I wrote to take the form information, enters it into a database, creates an html email and then sends it on to the user. After the email has been sent I need the page to redirect itself to a new Dreamweaver created html page. It should end up that the php page will be nothing more than a mere flash of white if anything as it travels between these two html pages. Everything works fine except trying to redirect the page after the email is sent. I've tried using an include and also a header statement but what happens is that the html page is being contructed inside the php page. The URL box is still showing the address of the php script. It displays the text from the called html page but none of the images or formatting from the page as it should be. I would really appreciate some help with this. I've attached the php script an commented at the end where the redirect needs to be. Thanks in advance for any help given. Barry [attachment deleted by admin] Link to comment https://forums.phpfreaks.com/topic/191263-problems-with-redirectgeturl/ Share on other sites More sharing options...
teamatomic Posted February 7, 2010 Share Posted February 7, 2010 Try using the redirect but put an exit; directly after the header statement and it should be the equivalent of a user clicking a link to thanks.html. As you have it with the include it will do just that, include the content of thanks.html into the php page. HTH Teamatomic Link to comment https://forums.phpfreaks.com/topic/191263-problems-with-redirectgeturl/#findComment-1008458 Share on other sites More sharing options...
barryhayden Posted February 7, 2010 Author Share Posted February 7, 2010 teamatomic, I'm not sure if I quite get what you mean. Are you saying do this? if(@mail($to, $subject, $body, $headers)){ //echo "output=sent"; header( 'Location: http://localhost/TGI/thanks.html' ); exit; include('../thanks.html'); } else { echo "output=error"; } } I tried adding that and tested it. It came back with... output=sent Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\TGI\php\tgiQuery.php:87) in C:\xampp\htdocs\TGI\php\tgiQuery.php on line 91 If you could help further I would appreciate it. And thanks for the help so far! Barry Link to comment https://forums.phpfreaks.com/topic/191263-problems-with-redirectgeturl/#findComment-1008480 Share on other sites More sharing options...
barryhayden Posted February 7, 2010 Author Share Posted February 7, 2010 teamatomic, I've got it working. I just had to get rid of the include. So now it looks like... if(@mail($to, $subject, $body, $headers)){ //echo "output=sent"; header( 'Location: http://localhost/TGI/thanks.html' ); exit; } else { echo "output=error"; } } Thanks so much for your help, I really appreciate it! I thought I was going to have a brain hemorrhage over it! Have a great rest of the weekend!!! Barry Link to comment https://forums.phpfreaks.com/topic/191263-problems-with-redirectgeturl/#findComment-1008489 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.