Currently, I use a method that allows me to basically contain more than one script in one file. I'm sure a lot of people are familiar with this, but I'll give an example.
There's a forum script, forum.php which displays the list of topics. When you choose a topic, that would go to forum.php?action=viewthread, and when you post a new topic it would go to forum.php?action=post, etc. Very simple.
In order to accomplish this, I do:
$action = $_GET['action'];
if($action == 'viewthread') {
// display thread
}
elseif($action == 'post') {
// form to post new message
}
else {
// topic list
}
However, I've been reading up on security and one of the things I've read is that error reporting should be set to E_ALL. Now, I'd be the first to say that my coding is never really the "proper" way to doing things, and therefore PHP started spitting out notices all over the place. I've been working to fix them, but this is one I'm just scratching my head over. It keeps saying that $_GET['action'] is undefined. But how can I find out ahead of time if its undefined, without actually using the variable? Is there an easier way to accomplish what I'm trying to do, that wouldn't keep giving notices?
Also, more of a side question - is it actually worth it? Should be going through, and fixing my code so that it follows what PHP feels as "proper"?
Thanks for the help.