How do i set a redirect?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • wizardry
    New Member
    • Jan 2009
    • 201

    #16
    not long like 30ns

    but with traffic, processing data from multiple threads could be like 120ns

    my objective is to have the page redirct into the page is was on to begin with.

    say for instance you register here,

    then the form doesnt take you to a new window after the processing it reloads the current window ( frame ).

    I want to stay away from frames as much as i can.

    thanks for you help in advance

    Comment

    • TheServant
      Recognized Expert Top Contributor
      • Feb 2008
      • 1168

      #17
      Well you can have this in your form which basically send the form to itself.
      Code:
      <form name="write_form" action="<?php echo $_SERVER['REQUEST_URI']; ?>"  method="post" >
      ...
      <input type="submit" name="form_submit" />
      Above this (above your form) you can have your include:
      Code:
      <?php include('processing_form_file.php'); ?>
      And in that processing form you can check if the page request type is from a post and if it was the submit button of that particular for that was pressed to stop it from trying to make your page when the form hasn't been submitted yet:
      Code:
      if ( $_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['form_submit']) )
      And if the form has been submitted then you can run your code.

      That will get it all on one page for you.

      Now, back on your processing page you need to assign a variable to tell the rest of the code the page has been created successfully so at the end of your processing_form _file.php (still in the if statement) you can have:
      Code:
      $page_created = true;
      Then just below your include() function you can have something like:
      Code:
      if (isset($page_created)) {
      echo("<p>Page created successfully</p><meta refresh to created page - which can be passed as a variable>");
      exit();
      }
      This will basically check if the page has been created and forward to the new page (no new window) without showing the form. Obviously this does not give the delay you need but it's a start in getting it in order.

      Comment

      • wizardry
        New Member
        • Jan 2009
        • 201

        #18
        thank you, i will post once i've tried this what my results are.

        Comment

        • wizardry
          New Member
          • Jan 2009
          • 201

          #19
          alright i've tried what you have posted but that has done nothing but error when i launch.

          I've research the errors but it is based on the new code that ou suggested i add.

          possibly could you add to the script that i copied above then repost.

          that way to ensure that i posted as you requested.

          thank again for your help

          also i've read up on the meta refresh.

          Comment

          • wizardry
            New Member
            • Jan 2009
            • 201

            #20
            if you need the form code as well i will post it

            Comment

            • TheServant
              Recognized Expert Top Contributor
              • Feb 2008
              • 1168

              #21
              Well I forgot about another function. I have never used it but I came across it recently: flush(). I just wrote that code off the top of my head and while I was doing other things, so I wouldn't be surprised if there are some errors. Just try and follow the logic and do your own version.

              Basically flush() outputs anything that has been previously declared, which is how i believe, when you have a long execution time you can have a progress level in how far through the code you are and give an estimation of time remaining. Anyway, see how you go with that. Post relevant code in [code] tags so I can see anything sticking out if there are errors.

              Comment

              Working...