Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Passing arrays through pages

Options
  • 31-03-2007 6:53pm
    #1
    Closed Accounts Posts: 44


    Hi

    I have created an array in one page, problem is i want to display it on another page. how do you go about transfering arrays from one page to another?

    Have had various attempts at it but havent got close in any of them

    The array is

    $arrErrors = array();

    Daryll


Comments

  • Registered Users Posts: 1,127 ✭✭✭smcelhinney


    In PHP?

    Well if its anything like java (I have no idea..), just add it to the session. Pseudo code would be
    init array
    init session object
    add array to session object as variable/attribute
    
    move to other page
    
    get object from session
    

    Maybe someone from a PHP background could explain it better. You could also take the chance passing it in a query string if its just a character array, but you'll have to encode/decode it on both sides.

    Best of luck
    Stephen


  • Registered Users Posts: 4,769 ✭✭✭cython


    One question I would have here is how is the array being generated exactly? Is it the result of a database query, or simply something you're constructing? It could make a difference to the solution depending on the answer to this


  • Closed Accounts Posts: 8,478 ✭✭✭GoneShootin


    If its PHP, you can serialize the array, pass it through in the URL, and re-create the array at the other side getting the serialized URL paramater


  • Closed Accounts Posts: 8,866 ✭✭✭Adam


    Why not use a session?


  • Closed Accounts Posts: 44 daryllsheridan


    Got it working using Sessions

    Looked into serialize ing it but didnt know how to go about it?
    How does it work?


  • Advertisement
  • Closed Accounts Posts: 8,478 ✭✭✭GoneShootin


    Looked into serialize ing it but didnt know how to go about it?
    How does it work?

    Google:

    http://www.thescripts.com/forum/thread3729.html


Advertisement