NYCPHP Meetup

NYPHP.org

[nycphp-talk] More questions about working with forms

Ben Sgro ben at projectskyline.com
Thu Dec 13 16:07:35 EST 2007


Hello,

Can you serialize the object and stick it in the $_SESSION?

- Ben

Tony Furnivall wrote:
> Thanks to those who replied earlier. I've moved on a little, and now 
> am wondering how to make an object 'persist' between activations of an 
> action script, associated with a button on the form.
>
> The model I have (the common thread of most replies) is something like 
> this (not in php, but in reasonably self-evident pseudo code):
>
> (firsttime) is determined by a test of the $_POST variables, or in 
> some similar way
>
> if (firsttime) then
>     showform and wait for action script {this script} to re-activate
> else
>     edit form data and build error stack
>     showform along with error stack and wait for next action
> end
>
> I can get this to work fine if I'm not using an object, but if I 
> create an object on the (firsttime) path, it disappears between then 
> and the next activation.
>
> The object includes not only the functions to build the form display, 
> but also the editing and error-stack management functions (no multiple 
> inheritance :-().
>
> Is it as simple as stashing away the object in a hidden field? or 
> maybe in some $_SESSION variable?
>
> Thanks for any help!
>
> Tony
>
>



More information about the talk mailing list