Re: passing array through $PHP_SELF
| From: | Jason Wong | Date: | Tue, 19 Mar 2002 03:56:13 +0000 |
| Subject: | Re: passing array through $PHP_SELF | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-17753@lists.php.net to get a copy of this message | ||
On Tuesday 19 March 2002 09:27, John Hughes, Jomari Works wrote:
> I have a page that selects students from a mysql table who meet a certain
> requirement. Those who meet the requirement have a check box variable that
> is "checked." (The other students have the check box, but it is unchecked.)
>
> The "checked" student id numbers are sent to the next PHP page. That page
> allows the user to edit the text of a message that will be sent to each of
> the students "checked" on the previous page.
>
> Up to this point I'm fine. I can pass the array of student ids and read
> them on the other page.
>
> What I want to do is use $PHP_SELF to allow the user to preview the letter
> after editing.
>
> My initial tries haven't worked. If I just submit $PHP_SELF the student id
> array disappears. When I attempt to create a "hidden" form field I get the
> message:
>
> Parse error: parse error, expecting
T_STRING' or S~¯wÌ
> `T_NUM_STRING'
>
> Right now I have the book open to implode and explode, figuring I can
> translate the array and then pass it back and forth, but that seems rather
> inelegant.
>
> Is there a "simple" way to pass an array when using $PHP_SELF to reload a
> page?
You can serialize() the array then pass it along in a hidden form element. Or
you can use cookies (sessions).
--
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
/*
"Why must you tell me all your secrets when it's hard enough to love
you knowing nothing?"
-- Lloyd Cole and the Commotions
*/