I want to call a form to edit a single record from a datagrid containing many records.
The edit form's datasource (data_select.php) dynamically queries a MySQL table to create a json file. It needs to receive the id key parameter.
e.g. data_select.php?entity_id=3 (where 3 is the parameter value being passed)
<?php
include '../../common/conn.php';
$eid = intval($_REQUEST['entity_id']);
$rs = mysql_query("SELECT entity_id, FirstName, MiddleName, LastName,Suffix,Phone,Mobile,AltPhone,Fax,Email FROM entity WHERE entity_id = $eid");
$items = array();
while($row = mysql_fetch_object($rs)){
array_push($items, $row);
}
$result["row"] = $items;
echo str_replace( array( '[', ']'), '', json_encode($items));
?>
The calling datagrid uses this function to open the edit form:
function openForm(){
var row = $('#dg').datagrid('getSelected');
if (row) {
url = "../supplieredit/supplieredit.php?entity_id=" + row.entity_id;
window.open(url,'_parent');
}
}
This seems to work fine
The edit form itself has its datasource definition like this:
$('#fm1').form('load','data_select.php?entity_id='+request.getParameter("entity_id"));
But it is not getting the parameter (herein lies the problem I think).Can anyone help please? Thanks in advance
