How to call another page from a php page?

Hi,
this surely is a very simple thing, but I’m still a newby and right now don’t know how to do it.
I want to call another page from a .php page:

(php.code processing a form)
// show a “Thank you” page

thankyou.html;

As it is not called through a link, I don’t know how to code that.

I know I could put some code in there to show a message, but I would like to show a new page.

Thanks for any help.

<?php
include(“thankyou.html”);
?>

That’ll insert thankyou.html into the current page.

Thanks, it works just fine.
Btw, I’m thrilled about the feedback speed.

Another question: If I want to show the new page in a new window, how do I do that?

Greetings!

depends how you have set up your form but you could do it this way using headers…

Form will say

<FORM ACTION=“<?php echo($PHP_SELF); ?>” METHOD=“POST”>

i.e. shows itself then you would have an if statement which says when clicked on submit goto the thanks page which would be…

if ( isset ( $submit ) ) at top of page to show that when clicked do the following (insert form detail into database etc)

then after sql statement

if (mysql_query($sql))
{
header(“Location: thanks.html”);
exit;
}
else {
echo(“<P>Error adding your details at this time.</P>” . mysql_error());
}

Hope that this helps can post full form if this isn’t clear

Sarah

Thanks, this works, but also opens the page in the same window. I wanted it to open in a new one.

sorry - being thick there thast what you asked for - anyway not sure how this would work but you could try target=blank?

Originally posted by Sarah
sorry - being thick there thast what you asked for - anyway not sure how this would work but you could try target=blank?

No, you’ll have to use Javascript.

hmm I don’t know how to do it in php so javascript as Abstraction says seems the way to go - how you would tie this in with php but maybe you could change the header to go to a javascript file which says open window… hmm not sure sorry have to bail on this one as I don’t know! but will keep a look out to learn the answer

Sorry

You can do something like this:
$url = “blah.html”;
echo "<script type=\“text/javascript\”>
<!–
open(‘$pageurl’);history.back();
//–>
</script>
";

but adding target=“_blank” to the <form>, as Sarah said, will also work.

Hi,

I tried the target=“_blank” in the form, as it seems the easiest way, and it works perfectly.

Thanks for your support.