PHP - GET Method parameter(id) Help!
PHP - GET Method parameter(id) Help!
xerk1
Posts: 6Questions: 5Answers: 1
Now I need to use paramter (id) (admin/control/sitting.php?id=2)
staff.php
<?php
/*
* Example PHP implementation used for the index.html example
*/
// DataTables PHP library
include( "../../php/DataTables.php" );
// Alias Editor classes so they are easy to use
use
DataTables\Editor,
DataTables\Editor\Field,
DataTables\Editor\Format,
DataTables\Editor\Mjoin,
DataTables\Editor\Options,
DataTables\Editor\Upload,
DataTables\Editor\Validate;
// Build our Editor instance and process the data coming from _POST
Editor::inst( $db, 'users', 'UID' )
->fields(
Field::inst( 'First_Name' )->validator( 'Validate::notEmpty' ),
Field::inst( 'Last_Name' )->validator( 'Validate::notEmpty' ),
Field::inst( 'Sitting_Number' )
)
->where( 'UID', $_GET['id'] )
->process( $_POST )
->json();
JS Code
$(document).ready(function() {
editor = new $.fn.dataTable.Editor( {
ajax: "examples/php/users.php",
ajaxUrl: "admin/control/sitting.php?id=1",
table: "#example",
fields: [ {
label: "First name:",
name: "First_Name"
}, {
label: "Last name:",
name: "Last_Name"
}, {
label: "Sitting Number:",
name: "Sitting_Number"
}
]
} );
var table = $('#example').DataTable( {
dom: "Bfrtip",
ajax: "examples/php/users.php",
columns: [
{
data: null,
defaultContent: '',
className: 'select-checkbox',
orderable: false
},
{ data: "First_Name" },
{ data: "Last_Name" },
{ data: "Sitting_Number" }
],
autoFill: {
columns: [ 3],
editor: editor
},
keys: {
columns: [ 3],
editor: editor,
},
select: {
style: 'os',
selector: 'td:first-child',
blurable: true
}
} );
} );
Alert MSG
This question has accepted answers - jump to:
This discussion has been closed.
Answers
any replay ?!
solved
close please
Thanks for posting back - good to hear you've got it working.
Allan