Clarification on $_SESSION variables [solved]

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

dyonak
Forum Commoner
Posts: 56
Joined: Wed Jun 22, 2005 10:22 am
Location: Minneapolis, MN
Contact:

Post by dyonak »

Ok I put the print_r($_SESSION); into my header2 it's displaying on all pages now. That variable is in my footer.php which is also included on all of my pages, so yes it's the same on all. Here's an example template for my pages.

Code: Select all

<?php
	include 'header1.php'; 
?>
<title>Dustin's Weekly</title>
<?php
	include 'header2.php';
?>
<!-- end masthead -->
<div id="content"> 
<h2 id="pageName">template</h2> 

<div class="feature">


</div>


</div> 
<!--end content -->
<?php
	include 'footer.php';
?>
The footer includes the sidebar with the form for changing styles, and the header2 includes the form handler with the $_SESSION['style'].p;gt;
<?php
include 'header2.php';
?&gt;
&lt;!-- end masthead --&gt;
&lt;div id=&quote;content&quote;&gt;
&lt;h2 id=&quote;pageName&quote;&gt;template&lt;/h2&gt;

&lt;div class=&quote;feature&quote;&gt;


&lt;/div&gt;


&lt;/div&gt;
&lt;!--end content --&gt;
&lt;?php
include 'footer.php';
?&gt;


The footer includes the sidebar with the form for changing styles, and the header2 includes the form handler with the $_SESSION['style'].it's the same on all. Here's an example template for my pages.

Code: Select all

<?php
	include 'header1.php'; 
?>
<title>Dustin's Weekly</title>
<?php
	include 'header2.php';
?>
<!-- end masthead -->
<div id="content"> 
<h2 id="pageName">template</h2> 

<div class="feature">


</div>


</div> 
<!--end content -->
<?php
	include 'footer.php';
?>
The footer includes the sidebar with the form for changing styles, and the header2 includes the form hann's Weekly</title>
<?php
include 'header2.php';
?>
<!-- end masthead -->
<div id="content">
<h2 id="pageName">template</h2>

<div class="feature">


</div>


</div>
&<!-- end masthead -->
<div id="content">
<h2 id="pageName">template</h2>

<div class="feature">


</div>


</div>
<!--end content -->
<?php
include 'footer.php';
?>


The footerat variable is in my footer.php which is also included on all of my pages, so yes it's the same on all. Here's an example template for my pages.

Code: Select all

<?php
	include 'header1.php'; 
?>
<title&gt;Dustin's Weekly&lt;/title&gt;
&lt;?php
	include 'header2.php';
?&gt;
&lt;!-- end masthead --&gt;
&lt;div id=&quote;content&quote;&gt; 
&lt;h2 id=&quote;pageName&quote;&gt;template&lt;/h2&gt; 

&lt;div class=&quote;feature&quote;&gt;


&lt;/div&a_r($_SESSION); into my header2 it's displaying on all pages now. That variable is in my footer.php which is also included on all of my pages, so yes it's the same on all. Here's an example template for my pages.

Code: Select all

<?php
	include 'header1.php'; 
?>
<title>Dustin's Weekly</title>
<?php
	include 'header2.php';
?>
<!-- end masthead -->
<div id="content"> 
<h2 id="pageName">template</h2> 

<div class="feature">


</div>


</div> 
<!--end content -->
<?php
	include 'footer.php';
?>
The footer includes the sidebar with the form for changing styles, and the header2 includes the form handler with the $_SESSION['style'].n all of my pages, so yes it's the same on all. Here's an example template for my pages.

Code: Select all

&lt;?php
	include 'header1.php'; 
?>
<title>Dustin's Weekly</title>
<?php
	include 'header2.php';
?>
<!-- end masthead -->
<div id=&quote;content&quote;&gt; 
&lt;h2 id=&quote;pageName&quote;&gt;template&lt;/h2&gt; 

&lt;div class=&quote;feature&quote;&gt;


&lt;/div&gt;


&a

Code: Select all

&lt;?php
	include 'header1.php'; 
?&gt;
&lt;title&gt;Dustin's Weekly&lt;/title&gt;
&lt;?php
	include 'header2.php';
?&gt;
&lt;!-- end masthead --&gt;
&lt;div id=&quote;content&quote;&gt; 
&lt;h2 id=&quote;pageName&quote;&gt;template&lt;/h2&gt; 

&lt;div class=&quote;feature&quote;&gt;


&lt;/div&gt;


&lt;/div&gt; 
&lt;!--end content --&luded on all of my pages, so yes it's the same on all. Here's an example template for my pages.

Code: Select all

&lt;?php
	include 'header1.php'; 
?&gt;
&lt;title&gt;Dustin's Weekly&lt;/title&gt;
&lt;?php
	include 'header2.php';
?&gt;
&lt;!-- end masthead --&gt;
&lt;div id=&quote;content"> 
<h2 id="pageName">template</h2> 

<div class="feature">


</div>


</div> 
<!--end content -->
&am on all of my pages, so yes it's the same on all. Here's an example template for my pages.

Code: Select all

<?php
	include 'header1.php'; 
?>
<title>Dustin's Weekly</title>
<?php
	include 'header2.php';
?>
<!-- end masthead -->
<div id="content"> 
<h2 id=&quote;pageName&quote;&gt;template&lt;/h2&gt; 

&lt;div class=&quote;feature&quote;&gt;


&lt;/div&gt;


&lt;/div&gt; 
&lt;!--end content --&gt;
&lt;?php
	include 'footer.php';
?&gt;
[/php:1:5ec2386p;amp;gt;
<!-- end masthead -->
<div id="content"> 
<h2 id="pageName">template</h2> 

<div class="feature">


</div>


</div> 
<!--end content -->
<?php
	include 'footer.php';
?>
The footer includes the sidebar with the form for changing styles, and the header2 includes the form handler with the $_SESSION['style'].p;lt;h2 id="pageName">template</h2>

<div class="feature">


</div>


</div>
<!--end content -->
<?php
include 'footer.php';
?>


The footer includes the sidebar with the form for changing styles, and the header2 includes the form handler with the $_SESSION['style']..php which is also included on all of my pages, so yes it's the same on all. Here's an example template for my pages.

Code: Select all

<?php
	include 'header1.php'; 
?>
<title>Dustin's Weekly</title>
<?php
	include 'header2.php';
?>
<!-- end masthead -->
<div id="content"> 
<h2 id=&quote;pageName&quote;&gt;template&lt;/h2&gt; 

&lt;div class="feature">


</div>


</div> 
<!--end content -->
<?php
	incng on all pages now. That variable is in my footer.php which is also included on all of my pages, so yes it's the same on all. Here's an example template for my pages.

Code: Select all

<?php
	include 'header1.php'; 
?>
<title>Dustin's Weekly</title>
<?php
	include 'header2.php';
?>
<!-- end masthead -->
<div id="content"> 
<h2 id="pageName">template</h2> 

<div class="feature">


</div>


</div> 
<!--end content -->
<?php
	include 'footer.php';
?>
The footer includes the sidebar with the form for changing styme on all. Here's an example template for my pages.

Code: Select all

<?php
	include 'header1.php'; 
?>
<title>Dustin's Weekly</title>
<?php
	include 'header2.php';
?>
<!-- end masthead -->
<div id="content"> 
<h2 id="pageName">template</h2> 

<div class="feature">


</div>


</div> 
<!--end content -->
<?php
	include 'footer.php';
?>
The footer includes the sidebar with the form for changing styles, and the header2 i
?>
<title>Dustin's Weekly</title&gt;
&lt;?php
include 'header2.php';
?>
<!-- end masthead -->
<div id="content">
<h2 id="pageName">template</h2>

<div class="feature">


</div>


</div>
<!--end content --&gt;
&lt;?php
include 'footer.php';
?&gt;


The footer includes the sidebar with the fo>


</div>


</div>
<!--end content -->
<?php
include 'footer.php';
?&gtDustin's Weekly</title>
<?php
include 'header2.php';
?>
<!-- end masthead -->
<div id=&quote;content&quote;&gt;
&lt;h2 id=&quote;pageName&qplaying on all pages now. That variable is in my footer.php which is also included on all of my pages, so yes it's the same on all. Here's an example template for my pages.

Code: Select all

<?php
	include 'header1.php'; 
?&gt;
&lt;title>Dustin's Weekly</title>
<?php
	include 'header2.php';
?&gt;
&lt;!-- end masthead --&gt;
&lt;div id=&quote;content&quote;&gt; 
&lt;h2 id=&quote;pageName&quote;&gt;template&lt;/h2&gt; 

&lt;div class=&quote;feature&quote;&gt;


&lt;/div&gt;


&lt;/div&gt; 
&lt;!--end content --&gt;
&lt;?php
	include 'footer.php';
?&;amp;lt;?php
	include 'header1.php'; 
?>
&lt;title&gt;Dustin's Weekly</title>
<?php
	include 'header2.php';
?>
<!-- end masthead --&gt;
&lt;div id=&quote;content&quote;&gt; 
&lt;h2 id=&quote;pageName&quote;&gt;template&lt;/h2&gt; 

&lt;div class=&quote;feature&quote;&gt;


&lt;/div&gt;


&lt;/div&gt; 
&lt;!--end

Code: Select all

<?php
	include 'header1.php'; 
?>
<title&gt;Dustin's Weekly&lt;/title&gt;
<?php
	include 'header2.php';
?>
<!-- end masthead -->
<div id="content"> 
<h2 id="pageName">template</h2> 

<div class="feature">


</div>


</div> 
<!--end content -->
<?php
	include 'footer.php';
?&gt;
The footer includes tlt;/div>


</div>
<!--end content -->
<?php
include 'footer.php';
?>


The footer includes the sidebar with the form for changing styles, and the header2 includes the form handler with the $_SESSION['style'].quote;>template</h2>

<div class="feature">


</div>


</div>
<!--end content -->
&lt;?php
include 'footer.php';
?&gt;


The footer includes the sidebar with the form for changing styles, and the header2 includes the form handler with the $_SESSION['style']. it's the same on all. Here's an example template for my pages.

Code: Select all

&lt;?php
	include 'header1.php'; 
?&gt;
&lt;title&gt;Dustin's Weekly&lt;/title&gt;
&lt;?php
	include 'header2.php';
?&gt;
&lt;!-- end masthead --&gt;
&lt;div id=&quote;content&quote;&gt; 
&lt;h2 id=&quote;pageName&quote;&gt;template&lt;/h2&gt; 

&lt;div class=&quote;feature&quote;&gt;


&lt;/div&gt;


&lt;/div&gt; 
&lt;!--end content --&gt;
&lt;?pho my header2 it's displaying on all pages now. That variable is in my footer.php which is also included on all of my pages, so yes it's the same on all. Here's an example template for my pages.

Code: Select all

&lt;?php
	include 'header1.php'; 
?>
<title>Dustin's Weekly</title>
<?php
	include 'header2.php';
?>
<!-- end masthead -->
<div id="content"> 
<h2 id="pageName">template</h2> 

<div class="feature">


</div>


</div> 
<!--end content -->
<?php
	include 'footer.php';
?>
The footer includes the sidebar with the form for changing styles, and the header2 includes the form handler with the $_SESSION['style'].
<?php
include 'header1.php';
?>
<title>Dustin's Weekly</title>
<?php
include 'header2.php';
?>
<!-- end masthead -->
<div id="content">
<h2 id="pageName">template</h2>

<div class="feature">


</div>


</div>
<!--end content -->
<?php
include 'footer.php';
?>


The footer includes the sidebar with the form for changing styles, and the header2 includes the form handler with the $_SESSION['style'].
User avatar
Burrito
Spockulator
Posts: 4715
Joined: Wed Feb 04, 2004 8:15 pm
Location: Eden, Utah

Post by Burrito »

I'm just suggesting you try printing out the array below the session_start() so you can determine if that value is set on your other pages.
dyonak
Forum Commoner
Posts: 56
Joined: Wed Jun 22, 2005 10:22 am
Location: Minneapolis, MN
Contact:

Post by dyonak »

Done, still brings up the array showing that the variable is there, it's just empty. Could something be flushing that variable when I leave the page?
dyonak
Forum Commoner
Posts: 56
Joined: Wed Jun 22, 2005 10:22 am
Location: Minneapolis, MN
Contact:

Post by dyonak »

Also, I added:

Code: Select all

$_SESSION['some_variable'] = "stuff";
To my "About" page, it works fine and remains populated throughout the site. It's gotta be something in my header2 code then:

Code: Select all

//Style sheet switcher v0.3b
if (isset ($_POST['submitstyle'])) {
	$style = $_POST['style'];
	$_SESSION['style'] = $style;
	print "<link rel='stylesheet' 

href='".$_SESSION['style']."' type='text/css' />";
	} else {
	print "<link rel='stylesheet' 

href='http://www.dustinyonak.net/2col_rightNav.css' 

type='text/css' />";
}
	$style = $_POST['style'];
	$_SESSION['style'] = "$style";
if (empty ($style)) {
	print "<link rel='stylesheet' 

href='http://www.dustinyonak.net/2col_rightNav.css' 

type='text/css' />";
	} else {
	print "<link rel='stylesheet' 

href='".$_SESSION['style']."' type='text/css' />";
}
$_SESSION['style'] = $style;
print &quote;&lt;link rel='stylesheet'

href='&quote;.$_SESSIONї'style'].&quote;' type='text/css' /&gt;&quote;;
} else {
print &quote;&lt;link rel='stylesheet'

href='http://www.dustinyonak.net/2col_rightNav.css'

type='text/css' /&gt;&quote;;
}
$style = $_POSTї'style'];
$_SESSIONї'style'] = &quote;$style&quote;;
if (empty ($style)) {
print &quote;&lt;link rel='stylesheet'

href='http://www.dustinyonak.net/2col_rightNav.css'

type='text/css' /&gt;&quote;;
} else {
print &quote;<link rel='stylesheet'

href='&quote;.$_SESSIONї'style'].&quote;' type='text/css' /&gt;&quote;;
}
s populated throughout the site. It's gotta be something in my header2 code then:

Code: Select all

//Style sheet switcher v0.3b
if (isset ($_POST['submitstyle'])) {
	$style = $_POST['style'];
	$_SESSION['style'] = $style;
	print "<link rel='stylesheet' 

href='".$_SESSION['style']."' type='text/css' />";
	} else {
	print "<link rel='stylesheet' 

href='http://www.dustinyonak.net/2col_rightNav.css' 

type='text/css' />";
}
	$style = $_POST['style'];
	$_SESSION['style'] = "$style";
if (empty ($style)) {
	print "<link rel='stylesheet' 

href='http://www.dustinyonak.net/2col_rightNav.css' 

type='text/css' />";
	} else {
	print "<link rel='stylesheet' 

href='".$_SESSION['style']."' type='text/css' />&am
	$style = $_POST['style'];
	$_SESSION['style'] = $style;
	print "<link rel='stylesheet' 

href='".$_SESSION['style']."' type='text/css' />";
	} else {
	print "<link rel='stylesheet' 

href='http://www.dustinyonak.net/2col_rightNav.css' 

type='text/css' />";
}
	$style = $_POST['style'];
	$_SESSION['style'] = "$style";
if (empty ($style)) {
t;link rel='stylesheet' 

href='".$_SESSION['style']."' type='text/css' />";
	} else {
	print "<link rel='stylesheet' 

href='http://www.dustinyonak.net/2col_rightNav.css' 

type='text/css' />";
}
	$style = $_POST['style'];
	$_SESSION['style'] = "$style";
if (empty ($style)) {
	print "<link rel='stylesheet' 

href='huff";
To my "About" page, it works fine and remains populated throughout the site. It's gotta be something in my header2 code then:

Code: Select all

//Style sheet switcher v0.3b
if (isset ($_POST&#1111;'submitstyle'])) {
	$style = $_POST&#1111;'style'];
	$_SESSION&#1111;'style'] = $style;
	print &quote;&lt;link rel='stylesheet' 

href='&quote;.$_SESSION&#1111;'style'].&quote;' type='text/css' /&gt;&quote;;
	} else {
	print &quote;&lt;link rel='stylesheet' 

href='http://www.dustinyonak.net/2col_rightNav.css' 

type='text/css' /&gt;&quote;;
}
	$style = $_POST&#1111;'style'];
	$_SESSION&#1111;'style'] = &quote;$style&quote;;
if (empty ($style)) {
	print &quote;&lt;link r

Code: Select all

$_SESSION['some_variable'] = "stuff";
To my "About" page, it works fine and remains populated throughout the site. It's gotta be something in my header2 code then:

Code: Select all

//Style sheet switcher v0.3b
if (isset ($_POST['submitstyle'])) {
	$style = $_POST['style'];
	$_SESSION['style'] = $style;
	print "<link rel='stylesheet' 

href='".$_SESSION['style']."' type='text/css' />";
	} else {
	print "<link rel='stylesheet' 

href='http://www.dustinyonak.net/2col_rightNav.css' 

type='text/css' />";
}
	$style = $_POST['style'];
	$_SESSION['style'] = "$style";
if (empty ($style)) {
	print "<link rel='stylesheet' 

href='http://www.dustinyonak.net/2col_rightNav.css' 

type='text/css' />";
	} else {
	print "<link rel='stylesheet' 

href='".$_SESSION['style']."' type='text/css' />";
}
[/p, it works fine and remains populated throughout the site. It's gotta be something in my header2 code then:

Code: Select all

//Style sheet switcher v0.3b
if (isset ($_POST['submitstyle'])) {
	$style = $_POST['style'];
	$_SESSION['style'] = $style;
	print "<link rel='stylesheet' 

href='".$_SESSION['style'].&quote;' type='text/css' /&gt;&quote;;
	} else {
	print &quote;&lt;link rel='stylesheet' 

href='http://www.dustinyonak.net/2col_rightNav.css' 

type='text/css' /&gt;&quote;;
}
	$style = $_POST&#1111;'style'];
	$_SESSION&#1111;'style'] = &quote;$style&quote;;
if (empty ($style)) {
	print &quote;&lt;link rel='stylesheet' 

hrheader2 code then:

Code: Select all

//Style sheet switcher v0.3b
if (isset ($_POST&#1111;'submitstyle'])) {
	$style = $_POST&#1111;'style'];
	$_SESSION&#1111;'style'] = $style;
	print &quote;&lt;link rel='stylesheet' 

href='&quote;.$_SESSION&#1111;'style'].&quote;' type='text/css' /&gt;&quote;;
	} else {
	print &quote;&lt;link rel='stylesheet' 

href='http://www.dustinyonak.net/2col_rightNav.css' 

type='text/css' /&gt;&quote;;
}
	$style = $_POST&#1111;'style'];
	$_SESSION&#1111;'style'] = &quote;$style&quote;;
if (empty ($style)) {
	print &quote;&lt;link rel='stylesheet' 

href='http://www.dustinyonak.net/2col_rightNav.css' 

type='text" page, it works fine and remains populated throughout the site. It's gotta be something in my header2 code then:

Code: Select all

//Style sheet switcher v0.3b
if (isset ($_POST&#1111;'submitstyle'])) {
	$style = $_POST&#1111;'style'];
	$_SESSION&#1111;'style'] = $style;
	print &quote;&lt;link rel='stylesheet' 

href='&quote;.$_SESSION&#1111;'style'].&quote;' type='text/css' />";
	} else {
	print "<link rel='stylesheet' 

href='http://www.dustinyonak.net/2col_rightNav.css' 

type='text/css' />";
}
	$style = $_POST['style'];
	$_SESSION['style'] = "$style";
ge, it works fine and remains populated throughout the site. It's gotta be something in my header2 code then:

Code: Select all

//Style sheet switcher v0.3b
if (isset ($_POST['submitstyle'])) {
	$style = $_POST['style'];
	$_SESSION['style'] = $style;
	print "<link rel='stylesheet' 

href='".$_SESSION['style']."' type='text/css' />";
	} else {
	print "<link rel='stylesheet' 

href='http://www.dustinyonak.net/2col_rightNav.css' 

type='text/css' />";
}
	$style = $_POST['style'];
	$_SESSION['style'] = "$style";
if (empty ($style)) {
	print "<link rel='stylesheet' 

href='http://www.dustinyonak.net/2col_rightNav.css' 

type='text/css' />";
	} else {
	print "<li;<link rel='stylesheet' 

href='".$_SESSION['style']."' type='text/css' />";
	} else {
	print "<link rel='stylesheet' 

href='http://www.dustinyonak.net/2col_rightNav.css' 

type='text/css' />";
}
	$style = $_POST['style'];
	$_SESSION['style'] = "$style";
if (empty ($style)) {
	print "<link rel='stylesheet' 

href='http://www.dustinyonak.net/2col_rightNav.css' 

type='text/css' />";
	} else {
	print "<link rel='stylesheet' 

href='".$_SESSION['style']."' type='text/css' />";
}
mp;quote;;
} else {
print "<link rel='stylesheet'

href='http://www.dustinyonak.net/2col_rightNav.css'

type='text/css' />";
}
$style = $_POST['style'];
$_SESSION['style'] = "$style";
if (empty ($style)) {
print "<link rel='stylesheet'

href='http://www.dustinyonak.net/2col_rightNav.css'

type='text/css' />";
} else {
print "<link rel='stylesheet'

href='&quote;.$_SESSIONї'style'].&quote;' type='text/css' /&gt;&quote;;
}
b89ef1]

To my "About" page, it works fine and remains populated throughout the site. It's gotta be something in my header2 code then:

Code: Select all

//Style sheet switcher v0.3b
if (isset ($_POST['submitstyle'])) {
	$style = $_POST['style'];
	$_SESSION['style'] = $style;
	print "<link rel='stylesheet' 

href='".$_SESSION['style']."' type='text/css' />";
	} else {
	print "<link rel='stylesheet' 

href='http://www.dustinyonak.net/2col_rightNav.css' 

type='text/css' />";
}
	$style = $_POST['style'];
	$_SESSION['style'] = "$style";
if (empty ($style)iable'] = "stuff";
To my "About" page, it works fine and remains populated throughout the site. It's gotta be something in my header2 code then:

Code: Select all

//Style sheet switcher v0.3b
if (isset ($_POST['submitstyle'])) {
	$style = $_POST['style'];
	$_SESSION['style'] = $style;
	print "<link rel='stylesheet' 

href='".$_SESSION['style']."' type='text/css' />";
	} else {
	print "<link rel='stylesheet' 

href='http://www.dustinyonak.net/2col_rightNav.css' 

type='text/css' />";
}
	$style = $_POST['style'];
	$_SESSION['style'] = "$style";
if (empty ($style)) {
	print "<link rel='stylesheet' 

href='http://www.dustinyonak.net/2col_rightNav.css' 

typ throughout the site. It's gotta be something in my header2 code then:

Code: Select all

//Style sheet switcher v0.3b
if (isset ($_POST['submitstyle'])) {
	$style = $_POST&#1111;'style'];
	$_SESSION&#1111;'style'] = $style;
	print &quote;&lt;link rel='stylesheet' 

href='&quote;.$_SESSION&#1111;'style'].&quote;' type='text/css' /&gt;&quote;;
	} else {
	print &quote;&lt;link rel='stylesheet' 

href='http://www.dustinyonak.net/2col_rightNav.css' 

type='text/css' /&gt;&quote;;
}
	$style = $_POST&#1111;'style'];
	$_SESSION&#1111;'style'] = &quote;$style&quote;;
if (empty ($style)) {
	print &quote;&lt;link rel='stylesheet' 

href='http://www.dustinyonak.net/2col_rightNav.css' 

type='text/css' /&gt;&quote;;
	} else {
	print &quote;&lt;link rel='stylesheet' 

href='&quote;.$_SESSION&#1111;'style'].&quote;' type='text/cr v0.3b
if (isset ($_POST['submitstyle'])) {
	$style = $_POST&#1111;'style'];
	$_SESSION&#1111;'style'] = $style;
	print "<link rel='stylesheet' 

href='".$_SESSION['style']."' type='text/css' />";
	} else {
	print "<link rel='stylesheet' 

href='http://www.dustinyonak.net/2col_rightNav.css' 

type='text/css' />";
}
	$style = $_POST['style'];
	$_SESSION['style'] = &quote;$style&quote;;
if (empty ($style)) {
	print &quote;&lt;link rel='stylesheet' 

href='http://www.dustinyonak.net/2col_rightNav.css' 

type='text/css' /&gt;&quote;;
	} else {
	print &quote;&lt;link rel='stylesheet' 

href='&quote;.$_SESSIONt/css' />";
}
	$style = $_POST['style'];
	$_SESSION['style'] = "$style";
if (empty ($style)) {
	print "&)) {
	$style = $_POST['style'];
	$_SESSION['style'] = $style;
	print "<link rel='stylesheet' 

href='".$_SESSION['style'].&quote;' type='text/css' /&gt;&quote;;
	} else {
	print &quote;&lt;link rel='stylesheet' 

href='http://www.dustinyonak.net/2col_rightNav.css' 

type='text/css' /&gt;&quote;;
}
	$style e_variable'] = "stuff";
To my "About" page, it works fine and remains populated throughout the site. It's gotta be something in my header2 code then:

Code: Select all

//Style sheet switcher v0.3b
if (isset ($_POST['submitstyle'])) {
	$style = $_POST['style'];
	$_SESSION['style'] = $style;
	print &quote;&lt;link rel='stylesheet' 

href='&quote;.$_SESSION&#1111;'style'].&quote;' type='text/css' /&gt;&quote;;
	} else {
	print &quote;&lt;link rel='stylesheet' 

href='http://www.dustinyonak.net/2col_rightNav.css' 

type='text/css' /&gt;&quote;;
}
	$style = $_POST&#1111;'style'];
	$_SESSION&#1111;'style'] = &quote;$style&quote;;
if (empty ($style)) {
	print &quote;&lt;link rel='stylesheet' 

href='http://www.dustinyonak.net/2col_rightNav.css' 

type='text/css' /&gt;&quote;;
	} else {
	pri1]
	//Style sheet switcher v0.3b
if (isset ($_POST&#1111;'submitstyle'])) {
	$style = $_POST['style'];
	$_SESSION['style'] = $style;
	print "<link rel='stylesheet' 

href='&quote;.$_SESSION&#1111;'style'].&quote;' type='text/css' /&gt;&quote;;
	} else {
	print &quote;&lt;link rel='stylesheet' 

href='http://www.dustinyonak.net/2col_rightNav.css' 

type='text/css' /&gt;&quote;;
}
	$style = $_POST&#1111;'style'];
	$_SESSION&#1111;'style'] = &quote;$style&quote;;
if (empty ($style)) {
	print &quote;&lt;link rel='stylesheet' 

href='http://www.dustinyonak.net/2col_rightNader2 code then:

Code: Select all

//Style sheet switcher v0.3b
if (isset ($_POST['submitstyle'])) {
	$style = $_POST&#1111;'style'];
	$_SESSION['style'] = $style;
	print "<link rel='stylesheet' 

href='".$_SESSION['style']."' type='text/css' />";
	} else {
	print "<link rel='stylesheet' 

href='http://www.dustinyonak.net/2col_rightNav.css' 

type='text/css' />";
}
	$style = $_POST['style'];
	$_SESSION['style'] = "$style";
if (empty ($style)) {
	print &quote;&lt;link rel='stylesheet' 

href='http://www.dustinyonak.net/2col_rightNav.css' 

type='text/css' /&gt;&quote;;
	} else {
	print &quote;&lt;link rel='stylesheet' 

href=ote;;
}
	$style = $_POST['style'];
	$_SESSION['style'] = "$style";
if (empty ($style)) {
	print "<link rel='stylesheet' 

href='http://www.dustinyonak.net/2col_rightNav.css' 

type='text/css' />";
	} else {
	print "<link rel='stylesheet' 

href='".$_SESSION['style']."' type='text/css' />";
}
quote;<link rel='stylesheet'

href='http://www.dustinyonak.net/2col_rightNav.css'

type='text/css' />";
}
$style = $_POST['style'];
$_SESSION['style'] = "$style";
if (empty ($style)) {
print &quote;&lt;link rel='stylesheet'

href='http://www.dustinyonak.net/2col_rightNav.css'

type='text/css' />";
} else {
print "<link rel='stylesheet'

href='".$_SESSION['style'].&quote;' type='text/css' /&gt;&quote;;
}
ns populated throughout the site. It's gotta be something in my header2 code then:

Code: Select all

//Style sheet switcher v0.3b
if (isset ($_POST['submitstyle'])) {
	$style = $_POST['style'];
	$_SESSION['style'] = $style;
	print "<link rel='stylesheet' 

href='".$_SESSION['style']."' type='text/css' />";
	} else {
	print "<link rel='stylesheet' 

href='http://www.dustinyonak.net/2col_rightNav.css' 

type='text/css' />";
}
	$style = $_POST['style'];
	$_SESSION['style'] = "$style";
if (empty ($style)) {
	print "<link rel='stylesheet' 

href='http://www.dustinyonak.net/2col_rightNav.css' 

type='text/css' />	$_SESSION['some_variable'] = "stuff";
To my "About" page, it works fine and remains populated throughout the site. It's gotta be something in my header2 code then:

Code: Select all

//Style sheet switcher v0.3b
if (isset ($_POST['submitstyle'])) {
	$style = $_POST['style'];
	$_SESSION['style'] = $style;
	print "<link rel='stylesheet' 

href='".$_SESSION['style']."' type='text/css' />";
	} else {
	print "<link rel='stylesheet' 

href='http://www.dustinyonak.net/2col_rightNav.css' 

type='text/css' />";
}
	$style = $_POST['style'];
	$_SESSION['style'] = "$style";
if (empty ($style)) {
	print "<link rel='stylesheet' 

href='http://www.dustinyonak.net/2col_rightNav.css' 

type='text/css' />";
	} else {
	print "<link rel='stylesheet' 

href='".$_SESSION['style']."' type='text/css' />";
}
User avatar
Burrito
Spockulator
Posts: 4715
Joined: Wed Feb 04, 2004 8:15 pm
Location: Eden, Utah

Post by Burrito »

are you sure you're not resetting $_SESSION['style'] somewhere?

if the other session vars are sticking, then you know sessions are working correctly.
dyonak
Forum Commoner
Posts: 56
Joined: Wed Jun 22, 2005 10:22 am
Location: Minneapolis, MN
Contact:

Post by dyonak »

That's exactly what I was thinking, I was just about to post and let you know I found it. After the first if...else statement I had another

Code: Select all

$style = $_POST['style'];
     $_SESSION['style'] = $style;
This was nulling out the variable since the $_POST is nothing at this point, and would only be something if it was coming from the form. Poor wording there but you get what I mean. Thanks again Burrito :)from the form. Poor wording there but you get what I mean. Thanks again Burrito :)style = $_POST['style'];
$_SESSION['style'] = $style;
This was nulling out the variable since the $_POST is nothing at this point, and would only be something if it was coming from the form. Poor wording there but you get whatonly be something if it was coming from the form. Poor wording there but you get what I mean. Thanks again Burrito :) again Burrito :) it. After the first if...else statement I had another

Code: Select all

$style = $_POST['style'];
     $_SESSION['style'] = $style;
This was nulling out the variable since the $_POST is nothing at tt I was thinking, I was just about to post and let you know I found it. After the first if...else statement I had another

Code: Select all

$style = $_POST['style'];
     $_SESSION['style'] = $style;
This was nulling out the variable since the $_POST is nothing at this point, and would only be something if it was coming from the form. Poor wording there but you get what I mean. Thanks again Burrito :)

Code: Select all

$style = $_POST['style'];
     $_SESSION['style'] = $style;
This was nulling out the variable since the $_POST is nothing at this point, and would only be something if it was coming from the form. Poor wording there but you get what I mean. Thanks again Burrito :) $style;
This was nulling out the variable since the $_POST is nothing at this point, and would only be soother

Code: Select all

$style = $_POST['style'];
     $_SESSION['style'] = $style;
This was nulling out the variable since the $_POST is nothing at this point, and would only be something if it was coming from the form. Poor wording there but you get what I mean. Thanks again Burrito :)

Code: Select all

$style = $_POST['style'];
     $_SESSION['style'] = $style;
This was nulling out the variable since the $_POST is nothing at this point, and would only be something if it was coming from the form. Poor wording there but you get what I mean. Thanks again Burrito :)ean. Thanks again Burrito :)lse statement I had another

Code: Select all

$style = $_POST['style'];
     $_SESSION['style'] = $style;
This was nulling out the variable since the $_POST is nothing at this point, and would only be something if it was coming from the form. Poor wording there but you get what I mean. Thanks again Burrito :)nd let you know I found it. After the first if...else statement I had another

Code: Select all

$style = $_POST['style'];
     $_SESSION['style'] = $style;
This was nulling out the variable since the $_POST is nothing at this point, and would only be something if it was coming from the form. Poor wording there but you get what I mean. Thanks again Burrito :)OST['style'];
$_SESSION['style'] = $style;
This was nulling out the variable since the $_POST is nothing at this point, and would only be something if it was coming from the form. Poor wording thince the $_POST is nothing at this point, and would only be something if it was coming from the form. Poor wording there but you get what I mean. Thanks again Burrito :)ould only be something if it was coming from the form. Poor wording there but you get what I mean. Thanks again Burrito :)ost and let you know I found it. After the first if...else statement I had another

Code: Select all

$style = $_POST['style'];
     $_SESSION['style'] = $style;
This was nulling out the variable since the $_POST is nothing at this point, and would only be something if it was coming from the form. Poor wording there but you get wha
This was nulling out the variable since the $_POST is nothing at this point, and would only be something if it was coming from the form. Poor wording there but you get what I mean. Thanks again Burrito :)tyle;
This was nulling out the variable since the $_POST is nothing at this point, and would only be something if it was coming from the form. Poor wording there but you get what I mean. Thanks again Burrito :)$style = $_POST['style'];
$_SESSION['style'] = $style;
This was nulling out the variable since the $_POST is nothing at this point, and would only be something if it was coming from the form. Poor wording there but you get what I mean. Thanks again Burrito :)
Post Reply