StevenMG Posted February 26, 2015 Share Posted February 26, 2015 I have the Contact Form working as needed. Am grateful for the help here! Been searching again for that one small piece of code that again eludes me. When a message is sent from the website the php code sends the message. Then a confirmation "Thank You" page opens. In the address bar it shows the name of the opened Thank You page as http://www.mywebsite/php/my_mail.php Using a template I created a Thank You HTML page and want the php code to open this page that will have a Close button. The Close button will take the user back to the index.html home landing page of the website and be done with the php file. This looked the most promising. However, I end up with a blank page from http://www.mywebsite/php/my_mail.php elseif (mail($sendto, $subject, $emailcontent, $headers)) { include(".http://www.mywebsite.com/thankyou.html"); } I also tried it without the leading dot inside the include() Thank you in advance! Quote Link to comment https://forums.phpfreaks.com/topic/294904-open-html-inside-php-code/ Share on other sites More sharing options...
NotionCommotion Posted February 26, 2015 Share Posted February 26, 2015 Make sure you understand the difference between server code (i.e. PHP) and client code (i.e. JavaScript) . Consider just making a link on the page to the next server page. Or if you want to use an include statement, use the path to the file and not a URI. Quote Link to comment https://forums.phpfreaks.com/topic/294904-open-html-inside-php-code/#findComment-1506782 Share on other sites More sharing options...
Solution QuickOldCar Posted February 26, 2015 Solution Share Posted February 26, 2015 This should work for you include($_SERVER['DOCUMENT_ROOT']."/thankyou.html"); Otherwise you can use a relative path file.php or folder/file.php , no forward slash assumes from it's base document's path / starts from root ./ is same directory ../ is up one directory ../../ , every ../ additional is up one directory Quote Link to comment https://forums.phpfreaks.com/topic/294904-open-html-inside-php-code/#findComment-1506786 Share on other sites More sharing options...
StevenMG Posted February 27, 2015 Author Share Posted February 27, 2015 QuickOldCar and NotionCommotion,Thank you for your replies! QuickOldCar, your code snippet suggestion is spot-on AGAIN!. It was pretty quick work to figure where it went in the PHP code Getting closer to the light at the end of the tunnel Am grateful for the time members here give to help when I get stuck. Back to the code Quote Link to comment https://forums.phpfreaks.com/topic/294904-open-html-inside-php-code/#findComment-1506919 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.