【发布时间】:2017-03-26 01:04:30
【问题描述】:
在此线程Changing value of a PHP string based on a condition check with AJAX 之后,我尝试将使用 Ajax 获取的选择框的值设置为会话变量。
我在 mainHTML.php 上开始了会话。我的ajaxScript.php 看起来像这样。 sortValue 是我要写入的会话值,valueChange 是选择框的值。
<?php
$_SESSION["sortValue"] = $_POST['valueChange']; //this doesn't show the select value dynamically
echo $_SESSION["sortValue"]; this does
?>
At the end of mainHTML.php, after having called all my PHP functions, I try calling echo $_SESSION["sortValue"];, but this value doesn't seem to change dynamically when selecting different options.
它被固定在一个单一的值上。我可能需要对会话做一些事情(销毁或取消设置),但我不确定。我该如何解决这个问题?
提前致谢。
【问题讨论】: