Jump to content

Open HTML inside PHP code


StevenMG

Recommended Posts

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!

Link to comment
https://forums.phpfreaks.com/topic/294904-open-html-inside-php-code/
Share on other sites

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.

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

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 :thumb-up:

 

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 8)

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.