PDA

View Full Version : Switch Case Help


Serge
03-11-2003, 09:36 PM
Ok I'm having problems with a switch case I'm trying to run on a script I'm trying to program.

here is the entire script with all the html as well.


<html>
<head>
<title>Surrix Article Manager</title>
</head>
<body bgcolor="#273549">
<basefont size=2 face=arial color=white>
<br>
<br>
<br>
<br>
<br>
<center><img src="cplogo.jpg"><br>
<a href="index2.php?nav=addarticle">Add Article</a> | <a href="index2.php?nav=adduser">Add User</a></center>
<br>
<br>
<br>

<?php

switch ($nav)
{
case "addarticle":
include ("adda.htm" );
break;

case "adduser":
include ("addu.htm" );
break;
}

?>


When I click on the links it doesn't do anything when it should include adda.htm or addu.htm where i have it. I have no clue what is going wrong would someone please help.

Xenon
03-11-2003, 09:40 PM
this will just work if register globals are ON in your php.ini
with php4.2.x it's off normally

Serge
03-11-2003, 09:45 PM
ah that is probably my problem I will check the phpinfo files.....

and they are off

Another question though which is better having them off or on is it a risk worth taking?

Xenon
03-11-2003, 09:49 PM
AFAIK it's not that risky, so you can turn it on.

but nevertheless you should try to write your scripts in a way so globals on isn't needed :)

Serge
03-11-2003, 09:50 PM
ok thanks for the advice