get array

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • kirke

    get array

    Hi,
    I have two arrays in previous page and use the arrays in next page.
    (Action page)
    how can I do this?

    Thank you

  • Erwin Moller

    #2
    Re: get array

    kirke wrote:
    Hi,
    I have two arrays in previous page and use the arrays in next page.
    (Action page)
    how can I do this?
    >
    Thank you
    put them in a session?
    $_SESSION["someArr"] = $someArr;

    or post them to the next page via post (form) or via GET.
    This involves some encoding of the array.

    Session is probably the easiest way to go.

    Regards,
    Erwin Moller

    Comment

    • Jerry Stuckle

      #3
      Re: get array

      kirke wrote:
      Hi,
      I have two arrays in previous page and use the arrays in next page.
      (Action page)
      how can I do this?
      >
      Thank you
      >
      You need to pass them onto the next page. You can do it in hidden
      fields on a form, the $_SESSION value, or even store them in a database
      and pass the key, i.e. in the form or $_SESSION or even a parameter in
      the URL of the next page.

      --
      =============== ===
      Remove the "x" from my email address
      Jerry Stuckle
      JDS Computer Training Corp.
      jstucklex@attgl obal.net
      =============== ===

      Comment

      • Krustov

        #4
        Re: get array

        <comp.lang.ph p>
        <kirke>
        <6 Nov 2006 03:24:08 -0800>
        <1162812248.829 522.49860@b28g2 000cwb.googlegr oups.com>
        I have two arrays in previous page and use the arrays in next page.
        (Action page)
        how can I do this?
        >
        - write them to a flat file

        - read the flat file on the next page


        --

        Comment

        • cldmismgr

          #5
          Re: get array

          Krustov wrote:
          <comp.lang.ph p>
          <kirke>
          <6 Nov 2006 03:24:08 -0800>
          <1162812248.829 522.49860@b28g2 000cwb.googlegr oups.com>
          >
          I have two arrays in previous page and use the arrays in next page.
          (Action page)
          how can I do this?
          >
          - write them to a flat file
          >
          - read the flat file on the next page
          >
          >
          --
          www.phpchatroom.co.uk
          This can be done with serialize and urlencode as follows.
          <?php
          if (isset($_REQUES T) {
          $decode_hidden = urldecode($_REQ UEST['hidden_array_v alue'];
          $new_array = unserialize($de code_hidden);
          }
          $array[] = 'one';
          $array[] = 'two';
          $pass_array = serialize($arra y);
          $encode_array = urlencode($pass );
          print "<form>";
          print "<input type='hidden' name='hidden_ar ray_value'
          value='$encode_ array' ";
          print "</form>";
          ?>

          The serialized array must be urlencoded to handle the characters
          injected by the serialize command.

          Craig

          Comment

          Working...