php variables won't save properly
I'm posting to a php script, and I want to update some already existing variables in the script. My javascript is this :
$('.submit_html').click( function(e) {
e.preventDefault();
var requested = $('.page_select').val();
var text = new Array($('.edit_html').val(), $('.header_val').val());
$.post('data_handlers/get_content.php', {page: requested, action: 'update', text: text}, function(data) {
alert(data);
});
})
There really isn't anything complicated about the post, just a couple variables to tell the script what to do, and then a text variable, with the data in the first two spots of the array.
On the php side, I know it is getting the data correctly, but when I try to overwrite the current variable in the script, it doesnt stay saved after the php script completes.
php code:
if ($page == 'home') {
$home = $text[0];
$home_head = $text[1];
return;
}
So obviously, it is changing the variables during the execution, but reverting to the values that were manually saved in the script before. Is there anyway to actually have the values stay changed after the script ends?
这听起来像会话模块是你想要做的事情的理想选择。
链接地址: http://www.djcxy.com/p/58866.html上一篇: 在if语句表达式中设置变量
下一篇: PHP变量将无法正常保存