【发布时间】:2013-02-24 12:56:09
【问题描述】:
我有一个包含以下页面的框架集:
top.php
left.php
right.html
right.html使用database.php通过json方式访问数据库,传递变量。 Left.php 具有选择列表,由数据库中的项目生成。选中后,该变量将存储在 Joomla 会话中,并刷新右侧页面。随着刷新 database.php 被 json 激活。
我的问题是:
我能够将变量存储在 Joomla 会话中。当我在 left.php 中对这个变量执行回显时,该变量会显示在屏幕上。但是,当我第一次激活 database.php 时,它不会从 joom 会话变量中获取值。虽然它已经在 left.php 中设置。但是,当我从 left.php 选择框中选择一个项目时,它确实有效。
left.php 中使用以下代码设置和获取变量:
//If the input select item was selected (when the user has selected a item from
select box) use that item to fill the Joomla session variable.
if(isset($_POST['PeriodeSelectname'])){
$JaarKwartaal=$_POST['PeriodeSelectname'];
$session->set('JaarKwartaal', $JaarKwartaal);
//echo "<P>session-set=" . $session->get('JaarKwartaal');
}
//if no item of the input select is selected (in case of the first time) the first
item of the $periodes array to fill the Joomla session variable
if(!isset($_POST['PeriodeSelectname'])){
$session->set('JaarKwartaal', $periodes[0]);
//echo "<P>session-notset=" . $session->get('JaarKwartaal');
}
我做错了什么?
提前致谢!
皮特
【问题讨论】:
标签: json session select joomla