I wonder whether someone could help me please.
I’m capturing a Session variable within a HTML form as follows:
$lid = $_SESSION['lid'];
From this main HTML form, using the following lines of code, I then load an external ajax table using the ‘mysqlajaxtableeditor` software:
</script>
<!-- Set ajax url -->
<script type="text/javascript">
trackHistory = false;
var ajaxUrl = 'Example3.php';
</script>
<body id="page2" onload="toAjaxTableEditor('update_html','');">
What I’d like to be able to do, is capture the Session variable from the main form and pass it to the external ajax table.
I’ve read a number of posts on this site which I hoped I would be able to solve my problem from, but I just can’t seem to pass the value across.
From what I’ve read, I’ve tried the following on my main form :
var ajaxUrl = 'Example3.php?lid=$lid';, then in the receiving AJAX table script, $lid = $_GET['lid']; but it doesn’t work and i’m not sure where I’m going wrong.
For additional information, I’ve posted the AJAX table code below:
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();
?>
I just wondered whether someone could possibly look at this please and let me knwo where I’m going wrong?
Many thanks and kind regards
After a lot of work and searching the Internet, I found the solution.
In the HMTL page I wrote this:
In my receiving AJAX Table Editor software script I wrote:
I hope this helps someone in the future.
Kind regards