Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

Passing arrays through pages

  • 31-03-2007 06: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, Registered Users 2 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, Registered Users 2 Posts: 4,844 ✭✭✭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