How to pass data between files in php 5 which is to be used on macintosh server?
to get more clear idea, i am writing code of both the files.
"test1.php"
session_start();
if($_post['txtuser']!= ""){
session_register("admin");
$_session['admin']=$_post['txtuser'];
pageredirect("tester2.php");
}
function pageredirect($page){
echo "";
}
?>
-------------------------
"test2.php"
echo $_session['admin'];
echo $_post['hidlog'];
echo $http_post_vars['hidlog'];
echo $http_session_vars['admin'];
?>
---------------------------------------------
i am not getting any value.
please help me out in this concern.
Hi Nishith -
I believe you need to call session_start() in *both* PHP files. There's a concise description of creating & resuming a session at the following link - Hope it helps!
http://us2.php.net/manual/en/function.session-start.php
--------
Brian S.
MacOSX.com Technical Support
brian@macosx.com
Dear Brian,
Thanks a lot for your reply. Yes, you are right, using session_start(), my half of the work is over. But how to pass value from one form to another? Hidden variables are not working on Mac Server. Even $_POST is not working. Please help me out in this concern soon.
Regards,
Nishith Shah.
nishith@cybervox.net
Hi Nishith -
Just a thought, check your /etc/php.ini file and make sure "register_globals" isn't set to "off". Recent updates changed this. Note that you may only have an /etc/php.ini.default file -- if you want to make changes copy it to /etc/php.ini first. Secondly, there's a detailed discussion of the "register_globals" setting and why it has been changed at
http://www-128.ibm.com/developerworks/opensource/library/os-php1/
- Brian
--------
Brian S.
MacOSX.com Technical Support
brian@macosx.com
By the way I may have not been very clear in what I said in my previous comments now that I read them back
The short version: Make sure register_globals is "on".
- Brian
--------
Brian S.
MacOSX.com Technical Support
brian@macosx.com