Jump to content

Switch is not working because of register_globals off


ramzess

Recommended Posts

Hi guys!

I just found out that my code for changing contents of a table cell is not working on some servers.
Later I found out why - it is because 'register_globals'  in php.ini is Off. On ones I tried this simple script
it was On.

This is my simple code. Sure now way to make it even more simple. But What can I do about it?
How can I define this variable $cng? If I define it a value script stops working. :(
I can't believe - it should be so common to use this one, please, is there really no way out?


[code]<?php
switch ($cng) {

case "1";
require ('content/page1.php');
break;

case "2";
require ('content/page2.php');
break;

default;
require ('content/page0.php');
}
?>[/code]

Of course, links for calling in those pages is like:

<a href="?cng=1">Page 1</a> and <a href="?cng=2">Page 2</a>


Is there a solution? Thank you.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.