# Weird PHP Session variable problem

**URL:** <https://forum.kirupa.com/t/weird-php-session-variable-problem/212644>\
**Category:** Uncategorized\
**Created:** [January 12, 2007, 8:06pm UTC](https://forum.kirupa.com/t/weird-php-session-variable-problem/212644 "2007-01-12T20:06:35Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![shane\_c](https://avatars.discourse-cdn.com/v4/letter/s/3be4f8/32.png) [@shane\_c](https://forum.kirupa.com/u/shane_c)\
**Post date:** [January 12, 2007, 8:06pm UTC](https://forum.kirupa.com/t/weird-php-session-variable-problem/212644/1 "2007-01-12T20:06:35Z")

</div>

I have a script that first sets $\_SESSION[order\_status] = ‘complete’, then changes the header location to a new php page, with ?order\_status=$\_SESSION[order\_status] attached to the URL. This new page checks to see if $\_SESSION[order\_status] == ‘complete’, and if not, gives a die() error. For some reason, this new page is not recognizing the $\_SESSION variable, it’s so weird… I can look in the URL and see ?order\_status=complete, so I know the variable has been set correctly, but for some reason it just isn’t being picked up on this new page. Here’s the code in the new page:

“first” page:

```php
if (mail($to, $subject, $message, $headers)) {
        $_SESSION['order_status'] = 'complete';
        header ("Location: http://www.am-eagle.com/checkout-confirm.php?order_status=$_SESSION[order_status]");
    }

```

beginning of “new” page:

```php
session_start();
if ( $_SESSION['order_status'] != 'complete' ) {
             die('Sorry, either you have reached this page in error, or we are experiencing technical difficulties. Please <a href="mailto:">email us</a> if the problem persists. Thank you!');
    }

```

Any ideas? This has been driving me nuts all morning.
