ramzess Posted September 20, 2006 Share Posted September 20, 2006 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 scriptit 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. Quote Link to comment Share on other sites More sharing options...
Barand Posted September 20, 2006 Share Posted September 20, 2006 Get the value of the variable from the querystring[code]$cng = $_GET['cng'];switch ($cng) {[/code]When coding, always assume the register_globals setting is OFF Quote Link to comment Share on other sites More sharing options...
ramzess Posted September 20, 2006 Author Share Posted September 20, 2006 Thank you Barand. Thank you.Oh yes, from now on I will work with register_globals Off to escape such situationswhen you suddenly find something is not working somewhere.Thank you. Quote Link to comment Share on other sites More sharing options...
Barand Posted September 20, 2006 Share Posted September 20, 2006 This should helphttp://www.php.net/manual/en/language.variables.external.php Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.