[PHP] Passing through Array's to another script

2001-12-18 Thread gkin

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?



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




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

2001-12-18 Thread TD - Sales International Holland B.V.



--  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. [EMAIL PROTECTED]
To: gkin [EMAIL PROTECTED]

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?

---

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




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

2001-12-18 Thread Jerry Verhoef (UGBI)

Maybe you should take a look at serialize and unserialize?

http://nl.php.net/manual/nl/function.serialize.php
http://nl.php.net/manual/nl/function.unserialize.php

With serialize you translate a variable to a string. With unserialize you
translate it back to the original variable

Jerry Verhoef

-Original Message-
From: TD - Sales International Holland B.V. [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, December 18, 2001 10:03 PM
To: [EMAIL PROTECTED]
Subject: Fwd: Re: [PHP] Passing through Array's to another script




--  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. [EMAIL PROTECTED]
To: gkin [EMAIL PROTECTED]

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?

---

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]


The information contained in this email is confidential and
may be legally privileged. It is intended solely for the 
addressee. Access to this email by anyone else is 
unauthorized. If you are not the intended recipient, any 
form of disclosure, production, distribution or any action 
taken or refrained from in reliance on it, is prohibited and 
may be unlawful. Please notify the sender immediately.

The content of the email is not legally binding unless 
confirmed by letter bearing two authorized signatures.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




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

2001-12-18 Thread Julio Nobrega Trabalhando

  Well, there's a small difference between form's GET/POST and passing
variables using the ? on urls. I don't know the techinal details of it, but
it's possible. I guess, on this particular case, the form method is POST.
When the next page is loaded (the action target), you put some GET
parameters too. It's not about the form, but the page that is being loaded.
Maybe it can receive GET and POST at the same time?... I guess that's the
case.

--

Julio Nobrega.

Um dia eu chego lá:
http://sourceforge.net/projects/toca




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




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

2001-12-18 Thread Jon Haworth

If you need to POST a form, but include some variables, you can use hidden
fields.

form action=script.php method=post
  input type=hidden name=a value=foo
  input type=hidden name=b value=bar
  input name=c
/form

Assuming someone now enters baz into the input called c, your POST data
is equivalent to doing a href=script.php?a=foob=barc=bazClick
here!/a

However, you can't do this:

form action=script.php?a=foob=bar method=post
  input name=c
/form

Because a  b won't get submitted.

Cheers
Jon


-Original Message-
From: Julio Nobrega Trabalhando [mailto:[EMAIL PROTECTED]]
Sent: 18 December 2001 14:32
To: [EMAIL PROTECTED]
Subject: Re: Re: [PHP] Passing through Array's to another script


  Well, there's a small difference between form's GET/POST and passing
variables using the ? on urls. I don't know the techinal details of it, but
it's possible. I guess, on this particular case, the form method is POST.
When the next page is loaded (the action target), you put some GET
parameters too. It's not about the form, but the page that is being loaded.
Maybe it can receive GET and POST at the same time?... I guess that's the
case.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




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

2001-12-18 Thread Julio Nobrega Trabalhando

 However, you can't do this:
 form action=script.php?a=foob=bar method=post
   input name=c
 /form
 Because a  b won't get submitted.

  Well, like I said, I don't understand very well, but things after the ?
are available on the action page, even if the method is POST. Here's a
tested example (PHP 4.1.0, Win2k AS, Apache 1.13.20)

aaa.php:
form method=post action=bbb.php?var=value
input type=submit
/form

bbb.php
?php
echo $HTTP_GET_VARS['var'].'br';
echo $_GET['var'].'br';
echo $REQUEST_METHOD;
?

  Shows:

value
value
POST

  So, the method is still POST, but things after ? are also available. What
should not work is this:

aaa.php:
form method=post action=bbb.php
input name=var
input type=submit
/form

bbb.php:

echo $_GET['var'];

  But for this one I didn't test...

--

Julio Nobrega.



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]