Link to home
Start Free TrialLog in
Avatar of adairwu
adairwu

asked on

More than one level redirect in php

Hi Experts,

I am wondering if I can have 2 or more redirect in the same browser using php?

for example, from webpage A, I need to redirect the browser to page B1 and then page B2. I know I can use header("Location: PageB1"); to redirect from A to B1 but page B1 is not on my website and I need the customer go to B1 and then B2.

 How about A->B1->B2->B3...? is it possible?

Thanks in advance
Avatar of Muhammad Wasif
Muhammad Wasif
Flag of Pakistan image

This is not possible.
ASKER CERTIFIED SOLUTION
Avatar of Muhammad Wasif
Muhammad Wasif
Flag of Pakistan image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of timeshell
timeshell

You may be able to use AJAX technology to accomplish something like this as well.
a1.php
--------
<?php
session_start();
$_SESSION["pages"]=array("a2.php","a3.php");
if (count($_SESSION["pages"]>0)) {
      $first=$_SESSION["pages"][0];
      $_SESSION["pages"]=array_shift($_SESSION["pages"]);
      echo "<script>location.href='$first'</script>";
      }
?>

a2.php with same code it goes till the end...
--------
<?php
session_start();
if (count($_SESSION["pages"]>0)) {
      $first=$_SESSION["pages"][0];
      $_SESSION["pages"]=array_shift($_SESSION["pages"]);
      echo "<script>location.href='$first'</script>";
      }
?>
-------