LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Red Hat (https://www.linuxquestions.org/questions/red-hat-31/)
-   -   RH9: PHP session problem (or Apache problem) (https://www.linuxquestions.org/questions/red-hat-31/rh9-php-session-problem-or-apache-problem-121763/)

fengcn 12-01-2003 06:32 PM

RH9: PHP session problem (or Apache problem)
 
Dear All,

I am running RH9 with httpd-2.0.40-21.5 and PHP-4.2.2-17.2.
I have two php files.

// ===== test1.php ========
<?php
if(isset($_POST['submit']))
{ session_start();
if(!isset($_SESSION['uname']))
$_SESSION['uname']=$_POST['nameinput'];
header('Location: test2.php');
};
?>

<html>
<head></head>
<body>
<form action="test1.php" method=''post">
<input type="text" name="nameinput'>
<input type="submit" name="submit" value=" SUBMIT ">
</form>
</body>
</html>


// =====test2.php ============
<?php
session_start();
?>

<html>
<head></head>
<body>
<?php
echo 'user: ' . $_POST['nameinput'];
echo 'user: ' . $_SESSION['uname'];
$_SESSION=array();
?>
</body>
</html>

// ============================

As far as I understood from PHP manual, the $_SESSION variable I set in test1.php should be passed to test2.php. However, I don't see any output from test2.php including the one from $_POST.

Is there any bug in PHP or Apache packed with RH9?
Should I upgrade to newer version of PHP and Apache?
I tried to upgrade Apache to 2.0.48, but it shown that it found a directory with version 1.3. It suggested me to migrate from 1.3 to 2.0.
I did but in a vain.

Any help is appreciated.
Thanks,

Edward


All times are GMT -5. The time now is 12:48 PM.