Hey,

I'm trying to make my own php forum deal.

(I know they're out there for free, but its more of an ego thing)

How do I get a page to redirect back to the last previous page?

For example, you post on say index.php and then when you click submit it goes to post.php confirming that you just posted. How do I then get post.php to go back to index.php or the previous page automatically?

Thanks,

DF

    [man]header[/man]('Location: http://some.uri.to/my/page');

    Note that some times the client will provide the previously visited page through the HTTP referrerer, available through $_SERVER['HTTP_REFERER'].

      is this how forums like phpbb do it?

      Thanks

        Couldn't tell you. You'd have to look at their code.

          Using Javascript could be another option so that the user can see "Thank you for posting" message for 5 seconds and redirects back to index.php

          in post.php use this

          <body>
          //watever code
          <script language="javascript">
          	window.setTimeout("location.href='index.php'",10000);
          </script>
          <? echo "Thanks for Posting"; ?>
          // watever code
          </body>
          

          Its in milli seconds. 10000 here means 10 seconds... so use it accordingly

          Good Luck
          TommYNandA

            Write a Reply...