Jump to content

[SOLVED] Stupid session edit problem...


NerdConcepts

Recommended Posts

I have no idea what is going on now. When someone enters the site it gives them a session...ok so what. Well when a business wants to edit their business info they can login. When they login it gives the a $_SESSION['edit_mode'] = 'FALSE'; When they want to actually edit their information they can enter "edit mode" which then changes the $_SESSION['edit_mode'] = 'TRUE'; yet when I try to change 'edit_mode' from false to true I get...

 

A session had already been started - ignoring session_start() 

 

There is NO code anywhere on the page that changes the 'edit_mode' value that starts a session. I don't understand why this is being such a pain in the butt. Here is all the code I am using.

 

if (isset($_GET['mode'])) {
if ($_GET['mode'] == 'TRUE') {
	$_SESSION['edit_mode'] = 'TRUE';
}

if ($_GET['mode'] == 'FALSE') {
	$_SESSION['edit_mode'] = 'FALSE';
}
}

 

Basically the link to enter edit mode is index.php?mode=TRUE and to leave edit mode it is index.php?mode=FALSE. Only a business that logs in will see these links. I have actually tried a few ways to do this. Even created 2 different pages. 1 to set the value to TRUE and 1 to set the value to FALSE...but they all don't work. When they were on separate pages, once the session value for 'edit_mode' was changed from FALSE to TRUE it would then redirect to the main page, but then there it would still show that the session value for 'edit_mode' was still FALSE when it has been changed to TRUE....

Link to comment
https://forums.phpfreaks.com/topic/42595-solved-stupid-session-edit-problem/
Share on other sites

I know all about session, lol. session_start(); is displayed within the header and that is called to on all pages, so I know that isn't the problem.

 

The problem was simple. I changed from using TRUE and FALSE and moved to using 0 and 1. Not sure how that changed anything, but it's all fixed. Thanks a bunch

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.