Please can someone tell me how you pass arrays between PHP pages.
$var = serialize($testArray);
echo INPUT NAME = \kcompany[]\ TYPE = \hidden\ VALUE=\$var\;
Then unserialize the variable on the receiving page.
Larry
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit:
1. you can put your array in string using implode() function and on next
page create the array back using explode() function.
$testArray = implode('|', $testArray);
# you will get: Apple|Banana|Peach
On next page: $testArray = explode('|', $testArray);
2. use serialize()/unserialize()
Subject: Re: [PHP] Passing Arrays between pages
1. you can put your array in string using implode() function and on next
page create the array back using explode() function.
$testArray = implode('|', $testArray);
# you will get: Apple|Banana|Peach
On next page: $testArray = explode
Please can someone tell me how you pass arrays between PHP pages.
$var = serialize($testArray);
echo INPUT NAME = \kcompany[]\ TYPE = \hidden\ VALUE=\$var\;
Then unserialize the variable on the receiving page.
To this you might also add an MD5 hash to check for authenticity,
depending on
To: motorpsychkill
Subject: Re: [PHP] passing arrays?
Always use isset() to check if something exists before trying
to use it if
originates externally to the running script.
you probabley need something like this
$level_0 = array('NONE');
$level_1 = array(PN, GALUP, VP, PUBUP, STATS
List
Subject: RE: [PHP] passing arrays?
On 12 December 2003 06:07, motorpsychkill wrote:
Thanks Tom, that worked! I knew that $$level had something
to do with it,
just wasn't sure what exactly. Thanks again.
-m
-Original Message-
From: Tom Rogers [mailto:[EMAIL PROTECTED
Thanks Tom, that worked! I knew that $$level had something to do with it,
just wasn't sure what exactly. Thanks again.
-m
-Original Message-
From: Tom Rogers [mailto:[EMAIL PROTECTED]
Sent: Thursday, December 11, 2003 9:34 PM
To: motorpsychkill
Subject: Re: [PHP] passing arrays
Try looking at this page
http://www.php.net/manual/en/function.serialize.php
Josh.
On February 28, 2003 08:22 am, Michiel van Heusden wrote:
I'm using this script to test passing arrays to a Session-variable.
?
session_start();
// method 1
$_SESSION['array1'] = array(item1, item2);
//
On Thursday 16 January 2003 20:58, [EMAIL PROTECTED] wrote:
Hello Everyone,
I've attempted this many times, but have failed to understand it each time.
I want to make it easier for myself to deal with passing variables through
a form. So I thought, why not use a single array variable to do
Thanks, I found the problem was with the creation of the 2-di array.
- Original Message -
From: Martin Towell [EMAIL PROTECTED]
To: 'DoL' [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Wednesday, July 31, 2002 12:21 PM
Subject: RE: [PHP] passing arrays between pages with serialize
Can you
: Wednesday, July 31, 2002 4:57 PM
Subject: Re: [PHP] passing arrays between pages with serialize
Hallo DoL,
it worked when i didn't use urldecode(), just stripslashes():
page-1
$s_array1 = urlencode(serialize($array1));
header(Location: page-2?h_array1=$s_array1);
page-2
$array1
Hallo DoL,
it worked when i didn't use urldecode(), just stripslashes():
page-1
$s_array1 = urlencode(serialize($array1));
header(Location: page-2?h_array1=$s_array1);
page-2
$array1 = unserialize(stripslashes($_GET[h_array1]));
The other way that worked was passing arrays in $_SESSION.
Can you post/send the results of doing a print_r() on the first page (the
one that's serialising) and the results of the serialize()?
-Original Message-
From: DoL [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, July 31, 2002 2:21 PM
To: [EMAIL PROTECTED]
Subject: [PHP] passing arrays between
$myarray = unserialize(urldecode($_GET['myarray']));
or am i wrong?
Regards Michael
Miguel Cruz [EMAIL PROTECTED] schrieb im Newsbeitrag
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
On Thu, 23 May 2002, wm wrote:
is there a way to pass arrays in forms or in the url?
if i have
Urldecode is automatic when you pass something through the URL. You can
call urldecode, but it doesn't do anything...
---John Holmes...
-Original Message-
From: Michael Virnstein [mailto:[EMAIL PROTECTED]]
Sent: Friday, May 24, 2002 9:33 AM
To: [EMAIL PROTECTED]
Subject: Re: [PHP
Yes,
You have to append the array name and values to the end of the url.
You've to pass each element from html to php and vice versa, another
method is using
input hidden
http://yoururl.com/index.phpmyarray[]=onemyarray[]=twomyarray[]=three
hi,
is there a way to pass arrays in forms or in the
Da. It will create a 3D array, so you would reference the data via:
echo $_GET[myarray][0];
// returns one;
echo $_GET[myarray][1];
// returns two;
...
Or, if you put this in a form, use _POST instead of _GET.
- Original Message -
From: wm [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent:
On Thu, 23 May 2002, wm wrote:
is there a way to pass arrays in forms or in the url?
if i have $myarray=array(one,two,three);
can i pass the whole array at once as opposed to having to pass each
individual element?
a href=whatever.php?myarray=?= urlencode(serialize($myarray)) ?
Then
Sorry, I have my brain set on sessions today... The serialize idea presented suggested
by Miguel is
a good way to do it.
- Original Message -
From: Nathan [EMAIL PROTECTED]
To: [EMAIL PROTECTED]; PHP [EMAIL PROTECTED]
Sent: Thursday, May 23, 2002 1:56 PM
Subject: Re: [PHP] passing
In your html input just add [] to the name of your variable so for example:
input type=text name=firstvar[] /
Rick
Not one of them who took up in his youth with this opinion that there are
no gods, ever continued until old age faithful to his conviction. - Plato
From: Navid Y. [EMAIL
Hi Navid
Don't you have to serialize it to put it in
sessions?
-Original Message-
From: Navid Y. [mailto:[EMAIL PROTECTED]]
Sent: May 18, 2002 2:26 PM
To: [EMAIL PROTECTED]
Subject: [PHP] passing ARRAYs through GET strings
Hello :)
Can anyone suggest of another way, an easier way,
Oh sorry I read your message wrong.. But the idea still stands..
a href=nextpage.php?var[]=1var[]=2var[]=3Link/a
Rick
Sir my concern is not whether God is on our side. My great concern is to be
on God's side. - Abraham Lincoln
From: Navid Y. [EMAIL PROTECTED]
Reply-To: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]
Sent: Saturday, May 18, 2002 1:31 PM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: RE: [PHP] passing ARRAYs through GET strings
Hi Navid
Don't you have to serialize it to put it in
sessions?
-Original Message-
From: Navid Y. [mailto:[EMAIL PROTECTED]]
Sent: May
]
Reply-To: [EMAIL PROTECTED]
Date: Sat, 18 May 2002 13:51:38 -0500
To: [EMAIL PROTECTED]
Subject: RE: [PHP] passing ARRAYs through GET strings
Thanks SP and Richard,
Well, I tested it and it works fine with sessions, without serializing
it. The only problem with sending it through GET url
($_SESSION['myarray']);
-Original Message-
From: Navid Y. [mailto:[EMAIL PROTECTED]]
Sent: May 18, 2002 2:52 PM
To: [EMAIL PROTECTED]
Subject: RE: [PHP] passing ARRAYs through GET
strings
Thanks SP and Richard,
Well, I tested it and it works fine with sessions,
without serializing
Baskett [mailto:[EMAIL PROTECTED]]
Sent: Saturday, May 18, 2002 2:12 PM
To: [EMAIL PROTECTED]; PHP General
Subject: Re: [PHP] passing ARRAYs through GET strings
Well what I normally do to pass very large arrays through strings.. when
NOT using sessions, I use serialize, but it sounds like you didn¹t
]
Subject: RE: [PHP] passing ARRAYs through GET strings
Okay let me clarify, if I had an array like this I
would just use sessions this way:
$myarray = array( array('1', '2'),
array('3', '4') );
$_SESSION['myarray'] = serialize($myarray);
Then you can use the array on any page the user
]
Reply-To: [EMAIL PROTECTED]
Date: Sat, 18 May 2002 14:43:27 -0500
To: 'PHP General' [EMAIL PROTECTED]
Subject: RE: [PHP] passing ARRAYs through GET strings
Well Rick,
Let's say I had a form with a text box and an textarea box. The text box
won't contain that many strings, but the textarea
Hey cool, didn't know that.
-Original Message-
From: Navid Y. [mailto:[EMAIL PROTECTED]]
Sent: May 18, 2002 3:45 PM
To: [EMAIL PROTECTED]
Subject: RE: [PHP] passing ARRAYs through GET
strings
No need to serialize arrays in PHP 4.0. They work
seamlessly, as if
you've passed a regular
Rick, what exactly do you mean by using
serialization without sessions? how do you do
that?
-Original Message-
From: Richard Baskett
[mailto:[EMAIL PROTECTED]]
Sent: May 18, 2002 4:31 PM
To: [EMAIL PROTECTED]; PHP General
Subject: Re: [PHP] passing ARRAYs through GET
strings
Hey
. - Napolean Hill
From: SP [EMAIL PROTECTED]
Date: Sat, 18 May 2002 16:35:00 -0400
To: Richard Baskett [EMAIL PROTECTED], [EMAIL PROTECTED], PHP
General [EMAIL PROTECTED]
Subject: RE: [PHP] passing ARRAYs through GET strings
Rick, what exactly do you mean by using
serialization without
Thanks Rick, that's what I thinking. Thought I
was missing something.
-Original Message-
From: Richard Baskett [mailto:[EMAIL PROTECTED]]
Sent: May 18, 2002 4:49 PM
To: SP; PHP General
Subject: Re: [PHP] passing ARRAYs through GET
strings
Well you can serialize an array using
On Monday 22 April 2002 11:40 am, Boaz Yahav wrote:
Suppose i have a multiple select posted to a script by a form.
now i have to send this array again with a new form to a new
script.
How do i do this?
thanks
berber
Hi Berber
you could serialize the array into a hidden field on
; PHP General (E-mail)
Subject: Re: [PHP] Passing Arrays
On Monday 22 April 2002 11:40 am, Boaz Yahav wrote:
Suppose i have a multiple select posted to a script by a form. now i
have to send this array again with a new form to a new script.
How do i do this?
thanks
berber
Hi Berber
Jason Jacobs wrote:
Hi all. I'm trying to pass an array to another page, and I'm not having
luck. I thought maybe it would do something slick by passing it in the
url, but it doesn't. So, how can I pass the array?
You can pass an array between pages by using the serialize() and
You could use sessions, but it may be overkill for what you are trying to
do.
--
phill
Jason Jacobs [EMAIL PROTECTED] wrote in message
001201c0fb50$6f895300$7feb1e18@superman">news:001201c0fb50$6f895300$7feb1e18@superman...
Hi all. I'm trying to pass an array to another page, and I'm not having
well, one idea is to serialize the array and put
into a HIDDEN text field to be submitted with
the FORM.
or, with no form, try this:
doc.php?myarray=. htmlentities(serialize($array));
-Original Message-
From: Clif [mailto:[EMAIL PROTECTED]]
Subject: [PHP] Passing arrays from page to
Hi Jordan,
Using sessions in PHP4, like this:
session_start();
$n = -1;
//Read an index from an Oracle table
while (OCIFetch($rs)) {
$n = $n + 1;
$ix[$n] = OCIResult($rs,1);
}
session_register("n");
session_register("ix");
In the next page you have a session_start() again, and
Cheers, that works great. I tried using urlencode but that doens't work like
it should in the manual.
Thanks,
Jord
On Thursday 05 April 2001 14:41, you wrote:
You have to do this:
$myarray = rawurlencode(serialize($myarray));
And then this on your other page:
$myarray =
Ive seen posts like this before ( 'how do I pass arrays as arguments to
functions?' ) this is quite simple, nothing at all has to be done.
?php
class test
{
function test($array)
{
foreach($array as $pos = $val)
echo "$pos : $val br\n";
}
}
$arr[] = 'chris ';
$arr[] = 'lee ';
"Conover, Ryan" wrote:
I was wondering if I can pass an array that has serialized objects to next
page via url encoding
$foo //array with serialized objects in it
with the following encoding
something/something/foobar.php?foo=echo($foo)
and be able too unserialize $foo on the
serialise it using serialize() - see under chapter 12 of the PHP manual
'Miscellaneous functions'
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: 23 January 2001 12:42
To: PHP list
Subject: [PHP] passing arrays via forms ..
howdy again :)
does anybody knwo
42 matches
Mail list logo