On Wednesday, 13 April 2011 at 18:55, Nathan Nobbe wrote: On Wed, Apr 13, 2011 at 11:49 AM, Jim Giner <jim.gi...@albanyhandball.com>wrote: > > > Can one create a set of $_POST vars within a script or is that not do-able? > > My display portion of my script utilizes the POST array to supply values to > > my input screen - this works well for the first display of an empty screen, > > and any following re-displays if there's an error in the user's input. But > > I want to use this same script/screen to display the results of a query > > when > > the user wants to update an existing record. > > > While a user script can populate $_POST this is generally prohibited as it's > typically populated by the environment. > > It would probly be cleaner to have the display portion of your script read > from an arbitrary array. > > Said arbitrary array could be populated by $_POST in one case and the > results of a query in another case.
While I don't necessarily disagree with you as far as abstracting the source of data goes, but it's never "prohibited", it just considered bad practice. Personally I've never understood this "thou shalt protect the superglobals" attitude. They're arrays, nothing more, use them in whatever way you want to. They're not sacred, endangered or likely to be overcome with the urge to kill you if you modify them. If your code changes its behaviour depending upon whether the data you're dealing with has come from within or without your code I think you have bigger style issues to address. All hail the superglobals! (sarcasm for those not familiar) -Stuart -- Stuart Dallas 3ft9 Ltd http://3ft9.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php