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.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.