Re: Using require instead of redirect architecture

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 2007-12-19 at 14:23 -0700, Dan wrote:
> ""Robert Erbaron"" <robert.erbaron@xxxxxxxxx> wrote in message 
> news:6164eea0712191255s228a9b0qfbf261ecf9e483ac@xxxxxxxxxxxxxxxxx
> >> 1.  p1.php would post to itself.  Do data validation.  After data 
> >> validation
> >>         upon error, include p1.php again with included error messages
> >>         upon success, redirect to p3.php with congrats.
> >
> > Yeah, I could do this, but it uses a redirect, and like you said, it's 
> > gnarly.
> >
> >> 2.  p1.php would post to p2. perform data validation.
> >>         upon error, save data into session variable, redirect back to 
> >> p1.php,
> >>                 display error messages inline
> >>         upon success, redirect to p3.php, display congrats
> >
> > I've already got this working, per thread of a couple days ago. But it
> > uses a redirect.
> >
> >> I personally like the second option.  It is cleaner.  Each page/script 
> >> has a single purpose in life.
> >>  It just makes better sense to my small little mind.
> >
> > I agree as well. But I'm trying to get away from multiple trips to the
> > server for simple page calls, per some pundits on the list. :) So I'm
> > trying to learn a different architecture, and I'm not getting it yet.
> >
> > -- 
> > RE, Chicago
> 
> Well, I would tend to agree with Jim, the second suggestion he had is the 
> way I've seen this problem done the most.  It works, it's simple and this 
> way you have one less PHP file, just enter your data and congratulations. 
> The load to the server shouldn't be any different if you did it the way you 
> suggested.  Oh, well just my opinion.

Sorry, but option one is superior YMMV :B Page posts to itself,
everything is already there, all the values posted, the form
description, associated validation etc. Then if successful you redirect
to the next logical page. Mind you, I assign predefined validation
routines, or custom handlers to the form before it is rendered so it all
makes sense to be in one place. Custom validators are pulled in as
needed from their own separate controller. I used the other technique
many years ago and I found it to be a hassle.

Cheers,
Rob.
-- 
...........................................................
SwarmBuy.com - http://www.swarmbuy.com

    Leveraging the buying power of the masses!
...........................................................

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux