Fwd: Re: [PHP] Passing through Array's to another script

From: Date: Tue, 18 Dec 2001 21:02:30 +0000
Subject: Fwd: Re: [PHP] Passing through Array's to another script
Groups: php.general 
Request: Send a blank email to php-general+get-78062@lists.php.net to get a copy of this message
---------- Forwarded Message ---------- Subject: Re: [PHP] Passing through Array's to another script Date: Tue, 18 Dec 2001 22:01:53 +0100 From: TD - Sales International Holland B.V. <td@salesint.com> To: "gkin" <gkin@cyntrix.nl> On Tuesday 18 December 2001 14:43, you wrote: Ok I'm a newbie but there some things I think I can point out. why does your ACTION have a GET method URL??? the ?xtabel should be filled in by the form not by you. Second you can't access arrays like print($xtabel) that will only print the constant Array not the values in there, you're gonna need a loop for that. I think the best solution for you would be to create sessions and register the array within the session. And like I said, making a POST form with a GET URL attached to it makes no sense to me at all. What you could try, but I'm guessing here is the following. print("<FORM METHOD=POST ACTION=\"script.php\">\n"); $val = current($xtabel); print("<INPUT TYPE=HIDDEN NAME=xtabel[] VALUE=\"$val\">\n"); /* You need the [] at xtabel cuz else the older value will be overwritten, this will make it clear to PHP that it's an array/hash*/ while ($val = next($xtabel) { print("<INPUT TYPE=HIDDEN NAME=xtabel[] VALUE=\"$val\">\n"); } print("INPUT TYPE=SUBMIT NAME=SUBMIT>\n"); print("</FORM>"); I HAVE NOT!!! tested this but I think it might work. Since I didn't check it might have some typos, you'll have to try I'm low on time and like I said I'm new to this also, so no guarentees :-). Kind regards > I want to pass through an array with content to another script. The array > is correctly filled with data. To do this I use the following code: > <FORM METHOD='post' ACTION='script.php?xtabel = <? print($xtabel); > ?>'> > > The content of the array is not recognised in the script.php. What is the > best way to do this? -------------------------------------------------------

« previous php.general (#78062) next »