0

I am using formmail by tactite to have the info submitted from my form get emailed to me. After the user hits the submit button, it goes to a "Thank You" page that by default just has some text, I'm trying to change that to load up a thank you page that I created and it doesn't work, what am I doing wrong?

Thanks!

Here's what doesn't work:

        // MSG_THANKS_PAGE is the default page that's displayed if the
        // submission is successful
        // Parameters: none
    $aMessages[MSG_THANKS_PAGE] = load('http://nimbledesigns.com/kelsie/thankyou.html');

This is what i had there before that DOES work:

   $aMessages[MSG_THANKS_PAGE] = 'Thanks!<br /><br />'.
                                  '<a href="http://nimbledesigns.com/kelsie">Go Back</a>'.
                                  '';

4 Answers 4

2

Tere is no load() function built into PHP. Most likely what you're looing for is file_get_contents(), which'll retrieve the contents of a file (local or otherwise) as a string.

If that URL points back to your own server, you may want to save yourself a full HTTP round-trip and simply use a local path ... = file_get_contents('/path/to/that/thank/you/file.html').

Sign up to request clarification or add additional context in comments.

Comments

1

File_get_Contents()

use

$aMessages[MSG_THANKS_PAGE] = file_get_contents('http://nimbledesigns.com/kelsie/thankyou.html');

instead.

Documentation

file_get_contents() - http://php.net/manual/en/function.file-get-contents.php

Alternatives

' If that file is on your server, then you may only need to do this:

$aMessages[MSG_THANKS_PAGE] = file_get_contents('thankyou.html');

That will stop PHP from using the HTTP stream connector and will use the File IO connector instead, which is going to be faster with less overhead (although the difference may only be viewable when your server is running slowly)

Redirects

You could also redirect them to the page, by issuing this command before you send any data to the browser:

header('Location: thankyou.html');
exit();

This will redirect their browser to the file. Again assuming it resides on your server. You could replace that with a the full address if required http://nimbledesigns.com/kelsie/thankyou.html

2 Comments

The redirect works as well as fixed my formatting issue, thanks!
don't forget the "exit();" part, this can throw your script off if you don't add it :) good luck
1

As stated earlier, file_get_contents is your best bet. There is no load() function.

But why not just redirect to the page? It says how to here: http://www.tectite.com/fmhowto/redir.php (I'm assuming that's the form mailer you're using, and "tactite" was a typo).

Comments

0

haven't used php load for a long time, but isn't it just for xml and returns an object? is this? http://php.net/manual/en/domdocument.load.php

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.