How do I output this array into another PHP?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • wolfiec
    New Member
    • Jan 2015
    • 1

    How do I output this array into another PHP?

    aaaaaaaaaaaaaaa aaaaaaaaaaaaaaa aaaaaaaaaaaaaaa aaaaaaaaaaaaa
  • Exequiel
    Contributor
    • Jul 2012
    • 288

    #2
    Did you mean to other php page? if that so you can try this sample below.
    First page.
    page1.php
    Code:
    <?php 
    ob_start();
    session_start();
    
    $_SESSION['country'] = array("USA", "CHINA", "PHILIPPINES");
    echo '<br><a href="page2.php">Other page</a>';
    ?>
    second page.
    page2.php
    Code:
    <?php 
    ob_start();
    session_start();
    $country = $_SESSION['country'];
    echo "I like " . $country[0] . ", " . $country[1] . " and " . $country[2] . ".";
    echo '<br><a href="page1.php">back</a>';
    ?>
    here we put the array content to our session country so that we can view the data to other php pages for your system.
    try it.

    Comment

    Working...