Angie
August 8, 2001, 1:38pm
1
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.
Angie
August 8, 2001, 1:47pm
3
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!
Sarah
August 8, 2001, 2:07pm
4
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
Angie
August 8, 2001, 2:35pm
5
Thanks, this works, but also opens the page in the same window. I wanted it to open in a new one.
Sarah
August 8, 2001, 2:40pm
6
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.
Sarah
August 8, 2001, 3:09pm
8
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.
Angie
August 9, 2001, 8:56am
10
Hi,
I tried the target=“_blank” in the form, as it seems the easiest way, and it works perfectly.
Thanks for your support.