0

I have at the top of my Page1.php the following.

<?php
    session_start();
    $_SESSION['ALL_YEAR'] = $_POST['ALL_YEAR'];
?>

I am trying to capture the form selection for a select called ALL_YEAR when this button is pushed:

<button type="button" value="Send" id="avgSubmitXLEW_1_12_3" onClick="location.href=this.value">Configure</button>

on Page2.php I have this at the top:

<?php
    session_start();
    $home = $_REQUEST['ALL_YEAR'];
?>

Farther down in the body of the page I have this:

<? echo $_session['home'];?>

The value is not showing up in the echo? What am I doing wrong?

4

2 回答 2

5

代替 :

$home = $_REQUEST['ALL_YEAR'];
...
<? echo $_session['home']; ?>

你应该做 :

$home = $_SESSION['ALL_YEAR'];
...
<?php echo $home; ?>
于 2012-10-11T17:19:15.700 回答
0

PHP 变量名区分大小写:

 <? echo $_session['home'];?>

应该

 <? echo $_SESSION['home'];?>
于 2012-10-11T17:21:35.103 回答