Hello y'all!
Recently i got a PHP update for my imitation server (A program which pretends to be a PHP server for local PHPing on my machine) Anyway, this update seems to have had various chanegs to it.
It is deciding to be VERY picky about array defining.
i.e have to have quotes (eg: $row['something'] rather than $row[something])
but my problem is this. I have an if statement or a switch statement involving a variable which may or may not be there. when the variable is set everything is hunky dory and good. However if you access the file without the varible being set (i.e index.php instead of index.php?action=bla) I get a whole bunch of errors!
Here is my code:
<?php
switch($action) {
case 'logon':
REQUIRE_ONCE('Tools/logon.php');
break;
default:
REQUIRE_ONCE('News.php');
break;
}
?>
if i accessindex.php?action=logon, the script exsecutes properly. it retrieves the Tools/logon.php file no problemo. However if i simply access index.php without setting the action variable i get this error:
Notice: Undefined variable: action in c:\program files\easyphp1-7\www\mountaincanon\mcparty\index.php on line 19
(line 19 is the switch($action) line in the above code.
Why is it doing this? and more importantly, how can i over come it?
cheers, i hope at least some of you understand that!!