PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Hi !
I'm beginner in php ! I have a code for showing my web sites pages in index.php file now I put this code to new web site but it dosn't work !!!!!
Can any one hlp me what is the problem ?!
It's because register_globals has been turned off on the new server. You will probably need to rewrite a lot of code if you've been depending on it being turned on but this is a good thing as it will make your code much easier to move between servers.
if($page=='default'){
print 'Web hosting, domain names and web design services by HostingMarkets ';
}
elseif($page=='About'){
print 'About HostingMarkets web hosting Company';
}
else{
print 'Web hosting, domain names and web design services by HostingMarkets';
}
twigletmac wrote:It's because register_globals has been turned off on the new server. You will probably need to rewrite a lot of code if you've been depending on it being turned on but this is a good thing as it will make your code much easier to move between servers.
Any variables being passed via the url should use $_GET. Any being passed via POST (e.g. a form using the POST method - which it should always use) should be referenced from $_POST.
Doing things this way gives you a better idea of where variables are coming from, and as stated already it ensures your code will work on nearly any PHP server (assuming its PHP5 safe also - not that hard ).
You should read up on using the GET and POST superglobals in the PHP manual. Give a good idea how they work, and why they are better.
Any variables being passed via the url should use $_GET. Any being passed via POST (e.g. a form using the POST method - which it should always use) should be referenced from $_POST.
Doing things this way gives you a better idea of where variables are coming from, and as stated already it ensures your code will work on nearly any PHP server (assuming its PHP5 safe also - not that hard ).
You should read up on using the GET and POST superglobals in the PHP manual. Give a good idea how they work, and why they are better.
I use this code for my site titel !!!
For example !