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!
I am just starting learning to create a homepage and I fall in love with PHP at the first glance. I have written some simple PHP scripts and tried them in localhost. Everything seems to be perfect. But they started frustating me since I put them in the real internet. The POST/GET methods do not work as they do in localhost.
The following experiment for example return "is set" in localhost but "is not set" when uploaded.
pagetwo.php
<?php
If (!isset($_REQUEST["page"])){
echo "Variable 'page' is not set.";
}else{
echo "Variable 'page' is set.";
}
?>
register_globals in php.ini is already turned OFF.
Using $_GET["page"] also makes no difference.
I can see the variable in URL (.../pagetwo.php?page=1).
I've been surfing everywhere to see what is going on. Can anybody help me to understand why this is happening.
:(
PHP version 4.2.2 in localhost. Version 4.0.6 in the internet server.
var_dump?(I don't really understand with this) but when I added var_dump($HTTP_GET_VARS); to the script it gave us something like this "array(1) { ["page"]=> string(1) "1" }"
The shorthanded variables (eg $_GET, $_POST, $_COOKIE) were introduced in PHP 4.1.0. You have a later version locally but an older one on your Server. The older version doesn't recgonize $_GET. Instead, use $HTTP_GET_VARS to solve the problem.