0

我想知道是否有人可以帮助我。

Session variable在 HTML 表单中捕获 a ,如下所示:

$lid = $_SESSION['lid'];

从这个主要的 HTML 表单中,使用以下代码行,然后我使用“mysqlajaxtableeditor”软件加载一个外部 ajax 表:

</script> 
 <!-- Set ajax url -->
        <script type="text/javascript">
            trackHistory = false;
            var ajaxUrl = 'Example3.php';
        </script>

<body id="page2" onload="toAjaxTableEditor('update_html','');">

我想要做的是Session variable从主窗体中捕获并将其传递给外部 ajax 表。

我已经阅读了该网站上的许多帖子,希望能够从中解决我的问题,但我似乎无法传递价值。

根据我的阅读,我在我的主要表单上尝试了以下内容: var ajaxUrl = 'Example3.php?lid=$lid';,然后在接收 AJAX 表脚本中,$lid = $_GET['lid'];但它不起作用,我不确定我哪里出错了。

有关其他信息,我在下面发布了 AJAX 表代码:

class Example1 extends Common
{
    function initiateEditor()
   {
      $tableColumns['findid'] = array('display_text' => 'Find ID', 'perms' => 'TV');
      $tableColumns['dateoftrip'] = array('display_text' => 'Date of Trip', 'perms' => 'ETV');
      $tableColumns['finddescription'] = array('display_text' => 'Find Description', 'perms' => 'ETV');
      $tableColumns['detectorname'] = array('display_text' => 'Detector Used', 'perms' => 'EVT');
      $tableColumns['searchheadname'] = array('display_text' => 'Search Head Used', 'perms' => 'ETV');
      $tableColumns['pasref'] = array('display_text' => 'PAS Ref.', 'perms' => 'ETV');

      $tableName = 'finds';
      $primaryCol = 'findid';
      $errorFun = array(&$this,'logError');
      $permissions = 'EID';

      require_once('php/AjaxTableEditor.php');
      $this->Editor = new AjaxTableEditor($tableName,$primaryCol,$errorFun,$permissions,$tableColumns);
      $this->Editor->setConfig('tableInfo','cellpadding="1" width="800" class="mateTable"');
      $this->Editor->setConfig('tableTitle','');
      $this->Editor->setConfig('orderByColumn','dateoftrip');
      $this->Editor->setConfig('editRowTitle','Edit Details');
      $this->Editor->setConfig('iconTitle','Edit Find Details');
   }


   function Example1()
   {
      if(isset($_POST['json']))
      {
         session_start();
         $this->mysqlConnect();
         if(ini_get('magic_quotes_gpc'))
         {
            $_POST['json'] = stripslashes($_POST['json']);
         }
         if(function_exists('json_decode'))
         {
            $data = json_decode($_POST['json']);
         }
         else
         {
            require_once('php/JSON.php');
            $js = new Services_JSON();
            $data = $js->decode($_POST['json']);
         }
         if(empty($data->info) && strlen(trim($data->info)) == 0)
         {
            $data->info = '';
         }
         $this->initiateEditor();
         $this->Editor->main($data->action,$data->info);
         if(function_exists('json_encode'))
         {
            echo json_encode($this->Editor->retArr);
         }
         else
         {
            echo $js->encode($this->Editor->retArr);
         }

      }
   }
}
$lte = new Example1();
?>

我只是想知道是否有人可以看看这个,让我知道我哪里出错了?

非常感谢和亲切的问候

4

1 回答 1

0

经过大量的工作和搜索互联网,我找到了解决方案。

在 HMTL 页面中,我写道:

 <!-- Set ajax url -->
        <script type="text/javascript">
            trackHistory = false;
            var ajaxUrl = 'ajaxtable.php?lid=$lid';
        </script>
<body id="page2" onload="toAjaxTableEditor('update_html','');">

在我收到的 AJAX 表编辑器软件脚本中,我写道:

function initiateEditor()
{
    $tableColumns['locationid'] = array('display_text' => '', 'perms' => '','data_filters' => array('filters' => array("='".$_SESSION['lid']."'")), 'default' => $_SESSION['lid']);

我希望这对将来的某人有所帮助。

亲切的问候

于 2012-07-08T13:57:36.443 回答