Re: 2D array by POST

[email protected] (Liz Tuddenham) Fri, 19 May 2023 07:19:47 +0100
Newsgroups comp.lang.php
Organization Poppy Records
Message-ID <1qayusl.14by37z1ufi932N%[email protected]>
J.O. Aho <[email protected]> wrote:

> On 5/18/23 23:38, The Doctor wrote:
> > In article <[email protected]>,
> > J.O. Aho <[email protected]> wrote:
> >> On 5/18/23 18:04, Liz Tuddenham wrote:
> >>> I need to send a 2-dimensional array from one file to another by POST.
> >>> The array is $item[][] with contents that are entirelyintegers.
> >>>
> >>> I have tried :
> >>>    Print "<INPUT TYPE=hidden NAME=item[] VALUE=$item>";
> >>> with
> >>> $item = stripslashes($_POST['item']);
> >>> but it does not work.
> >>>
> >>>    Any suggestions?
> >>
> >> 1. use session, store the value in the session and then use it in the
> >> next page directly from the session.
> >>
> >> 2. serialize the variable and base64 encode the serialized data, post
> >> this in the form and then base64 decode and unserialize.
> >>
> > 
> > Is base64 strong enugh?
> 
> It's not about the encryption, it's about not making the html to break
> as you don't know what the serialized data may contain.
> 
> if the data is sensitive or you want to avoid user manipulation of the
> data, then store the data in session and that is way it was number 1 of
> the suggestions.

The data isn't particularly sensitive, it is just a 'shopping list'
passed from one part of a shopping program to another.  It could have
been sent as dozens of individual variables, but that seemed clumsy as
they were already nicely wrapped up in an array.


-- 
~ Liz Tuddenham ~
(Remove the ".invalid"s and add ".co.uk" to reply)
www.poppyrecords.co.uk