[pmwiki-users] New recipe: AuxSelect

Patrick R. Michaud pmichaud at pobox.com
Mon Jan 29 11:52:13 CST 2007


On Sat, Jan 27, 2007 at 04:11:34PM -0000, marc wrote:
> 
> I can see that populating the array via a page is useful - and I have 
> thought about this - but the purpose of the recipe is to maintain state 
> across pages. 

Hmm.  FWIW, to maintain state across pages I was thinking one
would generally use something along the lines of:

    @session_start():
    if (@$_POST[]) {
      $_SESSION['inpstate'] = 
        array_merge((array)@$_SESSION['inpstate'], $_POST);
    }
    $InputDefaults = @$_SESSION['inpstate'];

Of course, this could be made a bit more sophisticated by specifying
the specific input controls to save state for, as opposed to the
above which simply saves all inputs.  (But I don't see any major
drawback to saving all inputs.)

Pm



More information about the pmwiki-users mailing list