i been writing huge scripts on my local machine which runs a Apache server, with MYSQL installed as a service, and PHP modules too.
The problem is, my scripts work perfectly offline, when uploaded to my server which also uses Apache, variables passed in the URL, are not retreived using $_GET['name'] method
for instance:
a url such as
http://www.aljam.co.uk?Action=Login
would be processed in my script as:
Action = $_GET[Login];
but Action is never assigned a value when testing online??
i've also tried using $_POST but to no avail, this is frustrating because the problem occurs only online!
is there any server configuration required? maybe something to do with register globals?
M
$_GET[], $_POST problems
Moderator: General Moderators
- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK
What version of PHP is being run on the server?
One possible cause of this would be having an older version of PHP on the server than you do on your development machine. To find out the version of PHP being used on the server put
into a file and upload it to the server. When it is run you'll get the current PHP version number, if that is less than 4.1, (eg. 4.0.6) then you cannot use $_POST, $_GET etc. instead you need to use $HTTP_POST_VARS, $HTTP_GET_VARS etc.
Mac
One possible cause of this would be having an older version of PHP on the server than you do on your development machine. To find out the version of PHP being used on the server put
Code: Select all
<?php echo 'PHP version is: '.phpversion(); ?>Mac
thanks
mate, ur a lifesaver, i checked the version and my server is still using version 4.0.1 .... they shou8ld keep up eh?!
one more thing could u give a example of using $HTTP_POST_VARS and $HTTP_GET_VARS im guessing its identical to $_GET ?
M
one more thing could u give a example of using $HTTP_POST_VARS and $HTTP_GET_VARS im guessing its identical to $_GET ?
M
- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK
The $HTTP_xxx_VARS arrays are the same as the $_POST, $_GET etc arrays in that you access the data the same way so:
However whilst the new arrays are autoglobals the old ones aren't - if you want to access them in a function you need to declare them as globals so,
More information about the predefined variables is available here:
http://www.php.net/manual/en/reserved.variables.php
Mac
Code: Select all
$HTTP_GET_VARSї'action'] === $_GETї'action']Code: Select all
function my_function ()
{
global $HTTP_POST_VARS, $HTTP_GET_VARS;
// function
}http://www.php.net/manual/en/reserved.variables.php
Mac