i'm realizing an admin panel and i need to toggle an option on/off. Everything works fine, except for the Configure::write() method that looks like if it's not permanent. Here is the ajax handler.
case ("toggle_button"):
if($_POST['status']=="On"){
Configure::write('tag_system',0);
die("Off");
}
elseif($_POST['status']=="Off"){
Configure::write('tag_system',1);
die("On");
}
break;
If i try
die(Configure::read('tag_system'));
it contains the correct value but when i reload the page, the value is missing. It's not set in the general config file but when i did, the behavious was similar but instead of a blank value, Configure::read returned the value in the config file.
How should i handle this?