Forum Moderators: coopster
PROBLEM:
<?php
// $_SESSION['cust_id'] has been set to say 6
echo $_SESSION[cust_id];//outputs 6
/*********************************************
The request below is for a few forms that post
the cust_id. In this case is hasn't been posted.
I've always found that a REQUEST just ignores it
if its not posted
***********************************************/
$cust_id=$_REQUEST['cust_id'];
echo $_SESSION[cust_id];//outputs nothing
?>
The REQUEST destroys the $_SESSION[cust_id] variable but only on my web hosts server.
MY SOLUTION
replace $cust_id=$_REQUEST['cust_id'];
with if(isset($_POST['cust_id']))$cust_id =$_POST['cust_id'];
MY QUESTIONS
Why would a REQUEST destroy a $_SESSION variable of the same index name?
Why only once the site is uploaded?
Let's say you have
$myvar = 6;
$_POST['myvar'] = 7;
With register_globals on, $myvar now equals 7, with it off, it still equals 6.
Solution, in your .htaccess file, include a line
php_flag register_globals Off
Then you will have the same behavior on both servers (assuming you are using Apache and not IIS)
Tom