mbowling Posted September 17, 2007 Share Posted September 17, 2007 I was told that is not correct to place $_POST global variables within a class. It was recommended to keep the $_POST variables in the index.php file. Why should the $_POST variables not be in a class? Thanks. Quote Link to comment Share on other sites More sharing options...
btherl Posted September 17, 2007 Share Posted September 17, 2007 Probably to make the class re-usable. If you hardcode $_POST into your class, then your class will only work with post forms with those particular variable names. But if you process the data in index.php then pass it to your class, the class is much more flexible. If you have no intention of ever re-using your class elsewhere, then yes you can use $_POST inside it and forget the whole thing You'll probably regret it later, but it's all a learning experience.. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.