SitePoint Sponsor

User Tag List

Results 1 to 10 of 10
  1. #1
    SitePoint Member
    Join Date
    Jul 2001
    Location
    Puerto Sta. María - Spain
    Posts
    17
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    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.

  2. #2
    You talkin to me? Anarchos's Avatar
    Join Date
    Oct 2000
    Location
    Austin, TX
    Posts
    1,438
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    <?php
    include("thankyou.html");
    ?>

    That'll insert thankyou.html into the current page.
    ck :: bringing chris to the masses.

  3. #3
    SitePoint Member
    Join Date
    Jul 2001
    Location
    Puerto Sta. María - Spain
    Posts
    17
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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!
    Last edited by Angie; Aug 8, 2001 at 06:56.

  4. #4
    blonde.... Sarah's Avatar
    Join Date
    Jul 2001
    Location
    Berkshire, UK
    Posts
    7,442
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    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

  5. #5
    SitePoint Member
    Join Date
    Jul 2001
    Location
    Puerto Sta. María - Spain
    Posts
    17
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks, this works, but also opens the page in the same window. I wanted it to open in a new one.

  6. #6
    blonde.... Sarah's Avatar
    Join Date
    Jul 2001
    Location
    Berkshire, UK
    Posts
    7,442
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    sorry - being thick there thast what you asked for - anyway not sure how this would work but you could try target=blank?

  7. #7
    code addict Abstraction's Avatar
    Join Date
    Apr 2001
    Location
    Des Moines, IA
    Posts
    346
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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.

  8. #8
    blonde.... Sarah's Avatar
    Join Date
    Jul 2001
    Location
    Berkshire, UK
    Posts
    7,442
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    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

  9. #9
    You talkin to me? Anarchos's Avatar
    Join Date
    Oct 2000
    Location
    Austin, TX
    Posts
    1,438
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You can do something like this:
    $url = "blah.html";
    echo "<script type=\"text/javascript\">\n<!--\nopen('$pageurl');history.back();\n//-->\n</script>\n";

    but adding target="_blank" to the <form>, as Sarah said, will also work.
    ck :: bringing chris to the masses.

  10. #10
    SitePoint Member
    Join Date
    Jul 2001
    Location
    Puerto Sta. María - Spain
    Posts
    17
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,

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

    Thanks for your support.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •