Jump to content

Open HTML inside PHP code


StevenMG
Go to solution Solved by QuickOldCar,

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
Share on other sites

  • Solution

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

Link to comment
Share on other sites

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)

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

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

Guest
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.