get array

This is a discussion on get array within the PHP Language forums, part of the PHP Programming Forums category; Hi, I have two arrays in previous page and use the arrays in next page. (Action page) how can I ...


Go Back   Usenet Forums > PHP Programming Forums > PHP Language

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 11-06-2006
kirke
 
Posts: n/a
Default 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

Reply With Quote
  #2 (permalink)  
Old 11-06-2006
Erwin Moller
 
Posts: n/a
Default 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

Reply With Quote
  #3 (permalink)  
Old 11-06-2006
Jerry Stuckle
 
Posts: n/a
Default 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@attglobal.net
==================
Reply With Quote
  #4 (permalink)  
Old 11-06-2006
Krustov
 
Posts: n/a
Default Re: get array

<comp.lang.php>
<kirke>
<6 Nov 2006 03:24:08 -0800>
<1162812248.829522.49860@b28g2000cwb.googlegroups. 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
Reply With Quote
  #5 (permalink)  
Old 12-07-2006
cldmismgr
 
Posts: n/a
Default Re: get array

Krustov wrote:
> <comp.lang.php>
> <kirke>
> <6 Nov 2006 03:24:08 -0800>
> <1162812248.829522.49860@b28g2000cwb.googlegroups. 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($_REQUEST) {
$decode_hidden = urldecode($_REQUEST['hidden_array_value'];
$new_array = unserialize($decode_hidden);
}
$array[] = 'one';
$array[] = 'two';
$pass_array = serialize($array);
$encode_array = urlencode($pass);
print "<form>";
print "<input type='hidden' name='hidden_array_value'
value='$encode_array' ";
print "</form>";
?>

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

Craig

Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 07:27 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0