Re: Using require instead of redirect architecture

From: Date: Wed, 19 Dec 2007 21:23:04 +0000
Subject: Re: Using require instead of redirect architecture
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-266120@lists.php.net to get a copy of this message
""Robert Erbaron"" <robert.erbaron@gmail.com> wrote in message news:6164eea0712191255s228a9b0qfbf261ecf9e483ac@mail.gmail.com...
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. - Dan

« previous php.general (#266120) next »