I can't figure out why my PHP session array disappears between page loads. The following code makes session_start() available on each page load:
<?php
session_start();
if ( isset( $_SERVER['QUERY_STRING'] ) && !empty($_SERVER['QUERY_STRING']) ) {
$gmeta_query_string = $_SERVER['QUERY_STRING'];
parse_str( $gmeta_query_string, $gmeta_query_array );
var_dump($gmeta_query_array);
foreach ( $gmeta_query_array as $key => $value ) {
$_SESSION[ 'gmeta_query_array' ][$key] = $value;
}
}
var_dump( $_SESSION );
echo session_id();
?>
Thinking perhaps it could be my server, here are some test URLs. This first link creates a session array and print its out, the second does prints an empty session array. Code is the same on both pages.
http://barbadospropertylist.com/wp-content/plugins/gravitymeta/test.php?name=value
http://barbadospropertylist.com/wp-content/plugins/gravitymeta/test.php
And here's a link to the PHP info: http://www.barbadospropertylist.com/phpinfo.php