This code used to work in earlier versions of PHP4 but no longer works on my website now that the hosting server has been upgraded to PHP5. Any easy way to alter this code to make it work again?
<?
if ($info == "file1") {include ("file1.html");}
if ($info == "file2") {include ("file2.html");}
if ($info == "file3") {include ("file3.html");}
if ($info == "file4") {include ("file4.html");}
if ($info == "file5") {include ("file5.html");}
?>
EDIT: yes, this is the code I have on the final website (not a PHP pro here). I call the “$info=_” just in a simple link (I’m wanting to return http://www.website.com/?info=file), ie:
<a href="?info=file1">Click here to read File 1</a>
Based on your edit, it seems that the problem is that you had
register_globalson in your old version of php in the php.ini file.register_globalsextracts all global variables so where you normally use$_GET['info'], withregister_globalson, you can simply use$info.This functionality is deprecated in php 5.3 and removed from php 5.4 as it poses a huge security risk.
To solve your problem, you can set the variable before your conditions: