Phalcon PHP: Select option value POST in table using DataTable
I have a problem in getting the value in my field, I am using DataTable for my table.
My error is , the selected value is not posting in table.
here's my code...
NOTE: I'm using Phalocon PHP , DataTable API for phalcon.
here's my controller :
public function orderWalkinAction()
{
$this->view->disable();
if($this->request->isPost()) {
$arr = array();
$dropdown_id = $this->request->getPost('dropdown_id', 'striptags');
$select_orderitems_query = Medics::find(
[
"conditions" => "medID = :id: AND status = 'ACTIVE'",
"bind" =>
[
"id" => $dropdown_id,
]
]
);
foreach ($select_orderitems_query as $data_orderItem) {
$orderitem_medID = $data_orderItem->medID;
$orderitem_code = $data_orderItem->itemcode;
$orderitem_name = $data_orderItem->itemname;
$orderitem_brand = $data_orderItem->itembrand;
$orderitem_quan = $data_orderItem->itemquan;
$orderitem_price = $data_orderItem->itemprice;
$orderitem_totalprice = $data_orderItem->totalPrice;
$arr = array(
"itemcode" => $orderitem_code,
"itemname" => $orderitem_name."-".$orderitem_brand,
"itemquan" => $orderitem_quan,
"itemprice" => $orderitem_price,
"total" => $orderitem_totalprice,
"action" => "<button class='btn btn-danger' id='orderRecord-delete' data-id='".$orderitem_medID."'><i class='fa fa-trash'></i></button>"
);
}
$dataTables = new DataTable();
$dataTables->fromArray($arr)->sendResponse();
}
}
Here's my Js
$(document).on('change', '#items', function(e) {
e.preventDefault();
var dropdown_val = $(this).val();
if(dropdown_val != null)
{
//Table For Order Items
$('#order_tbl').DataTable({
processing: true,
deferRender: true,
ajax: {
url: '/HPsys/walkin/orderWalkin',
method: 'POST',
data: { dropdown_id : dropdown_val }
},
columns: [
{ data : "itemcode" },
{ data : "itemname" },
{ data : "itemquan" },
{ data : "itemprice" },
{ data : "total" },
{ data : "action" },
]
});
}
else
{
}
});
Here's my View
<select class="form-control" id="items">
<option value="">-- Select Item --</option>
</select>
<hr>
<h2 class="text-center">Order Details </h2>
<table class="table" id="order_tbl">
<thead>
<tr>
<th>Item Code</th>
<th>Item Name</th>
<th>Quantity</th>
<th>Price</th>
<th>Total</th>
<th>Action</th>
</tr>
</thead>
</table>
If there's a vlog/tutorial/ or any recommendation please feel free to comment, I really appreciate that.
javascript mysql phalcon
|
show 10 more comments
I have a problem in getting the value in my field, I am using DataTable for my table.
My error is , the selected value is not posting in table.
here's my code...
NOTE: I'm using Phalocon PHP , DataTable API for phalcon.
here's my controller :
public function orderWalkinAction()
{
$this->view->disable();
if($this->request->isPost()) {
$arr = array();
$dropdown_id = $this->request->getPost('dropdown_id', 'striptags');
$select_orderitems_query = Medics::find(
[
"conditions" => "medID = :id: AND status = 'ACTIVE'",
"bind" =>
[
"id" => $dropdown_id,
]
]
);
foreach ($select_orderitems_query as $data_orderItem) {
$orderitem_medID = $data_orderItem->medID;
$orderitem_code = $data_orderItem->itemcode;
$orderitem_name = $data_orderItem->itemname;
$orderitem_brand = $data_orderItem->itembrand;
$orderitem_quan = $data_orderItem->itemquan;
$orderitem_price = $data_orderItem->itemprice;
$orderitem_totalprice = $data_orderItem->totalPrice;
$arr = array(
"itemcode" => $orderitem_code,
"itemname" => $orderitem_name."-".$orderitem_brand,
"itemquan" => $orderitem_quan,
"itemprice" => $orderitem_price,
"total" => $orderitem_totalprice,
"action" => "<button class='btn btn-danger' id='orderRecord-delete' data-id='".$orderitem_medID."'><i class='fa fa-trash'></i></button>"
);
}
$dataTables = new DataTable();
$dataTables->fromArray($arr)->sendResponse();
}
}
Here's my Js
$(document).on('change', '#items', function(e) {
e.preventDefault();
var dropdown_val = $(this).val();
if(dropdown_val != null)
{
//Table For Order Items
$('#order_tbl').DataTable({
processing: true,
deferRender: true,
ajax: {
url: '/HPsys/walkin/orderWalkin',
method: 'POST',
data: { dropdown_id : dropdown_val }
},
columns: [
{ data : "itemcode" },
{ data : "itemname" },
{ data : "itemquan" },
{ data : "itemprice" },
{ data : "total" },
{ data : "action" },
]
});
}
else
{
}
});
Here's my View
<select class="form-control" id="items">
<option value="">-- Select Item --</option>
</select>
<hr>
<h2 class="text-center">Order Details </h2>
<table class="table" id="order_tbl">
<thead>
<tr>
<th>Item Code</th>
<th>Item Name</th>
<th>Quantity</th>
<th>Price</th>
<th>Total</th>
<th>Action</th>
</tr>
</thead>
</table>
If there's a vlog/tutorial/ or any recommendation please feel free to comment, I really appreciate that.
javascript mysql phalcon
@Phil yeah sure, my bad.
– koroku
Nov 20 '18 at 5:39
What debugging have you done? I'd start by looking in the browser's Network console... inspect the AJAX request and check what data its sending? FYI, you have no useful<option>
elements in your<select>
so I'm not sure what sort of value you expect
– Phil
Nov 20 '18 at 5:41
@Phil in my<option>
I append the dropdown using javascript , then what I am expecting is when I select one of the value in my<select>
it will appear in my DataTable
– koroku
Nov 20 '18 at 5:45
So, about that Network console...
– Phil
Nov 20 '18 at 5:46
1
@Phil ohh.. sorry my bad, my error only is the url of the API i used in dataTable for phalcon. I just review the documentation of that API then I get to that. that's it.
– koroku
Nov 22 '18 at 1:28
|
show 10 more comments
I have a problem in getting the value in my field, I am using DataTable for my table.
My error is , the selected value is not posting in table.
here's my code...
NOTE: I'm using Phalocon PHP , DataTable API for phalcon.
here's my controller :
public function orderWalkinAction()
{
$this->view->disable();
if($this->request->isPost()) {
$arr = array();
$dropdown_id = $this->request->getPost('dropdown_id', 'striptags');
$select_orderitems_query = Medics::find(
[
"conditions" => "medID = :id: AND status = 'ACTIVE'",
"bind" =>
[
"id" => $dropdown_id,
]
]
);
foreach ($select_orderitems_query as $data_orderItem) {
$orderitem_medID = $data_orderItem->medID;
$orderitem_code = $data_orderItem->itemcode;
$orderitem_name = $data_orderItem->itemname;
$orderitem_brand = $data_orderItem->itembrand;
$orderitem_quan = $data_orderItem->itemquan;
$orderitem_price = $data_orderItem->itemprice;
$orderitem_totalprice = $data_orderItem->totalPrice;
$arr = array(
"itemcode" => $orderitem_code,
"itemname" => $orderitem_name."-".$orderitem_brand,
"itemquan" => $orderitem_quan,
"itemprice" => $orderitem_price,
"total" => $orderitem_totalprice,
"action" => "<button class='btn btn-danger' id='orderRecord-delete' data-id='".$orderitem_medID."'><i class='fa fa-trash'></i></button>"
);
}
$dataTables = new DataTable();
$dataTables->fromArray($arr)->sendResponse();
}
}
Here's my Js
$(document).on('change', '#items', function(e) {
e.preventDefault();
var dropdown_val = $(this).val();
if(dropdown_val != null)
{
//Table For Order Items
$('#order_tbl').DataTable({
processing: true,
deferRender: true,
ajax: {
url: '/HPsys/walkin/orderWalkin',
method: 'POST',
data: { dropdown_id : dropdown_val }
},
columns: [
{ data : "itemcode" },
{ data : "itemname" },
{ data : "itemquan" },
{ data : "itemprice" },
{ data : "total" },
{ data : "action" },
]
});
}
else
{
}
});
Here's my View
<select class="form-control" id="items">
<option value="">-- Select Item --</option>
</select>
<hr>
<h2 class="text-center">Order Details </h2>
<table class="table" id="order_tbl">
<thead>
<tr>
<th>Item Code</th>
<th>Item Name</th>
<th>Quantity</th>
<th>Price</th>
<th>Total</th>
<th>Action</th>
</tr>
</thead>
</table>
If there's a vlog/tutorial/ or any recommendation please feel free to comment, I really appreciate that.
javascript mysql phalcon
I have a problem in getting the value in my field, I am using DataTable for my table.
My error is , the selected value is not posting in table.
here's my code...
NOTE: I'm using Phalocon PHP , DataTable API for phalcon.
here's my controller :
public function orderWalkinAction()
{
$this->view->disable();
if($this->request->isPost()) {
$arr = array();
$dropdown_id = $this->request->getPost('dropdown_id', 'striptags');
$select_orderitems_query = Medics::find(
[
"conditions" => "medID = :id: AND status = 'ACTIVE'",
"bind" =>
[
"id" => $dropdown_id,
]
]
);
foreach ($select_orderitems_query as $data_orderItem) {
$orderitem_medID = $data_orderItem->medID;
$orderitem_code = $data_orderItem->itemcode;
$orderitem_name = $data_orderItem->itemname;
$orderitem_brand = $data_orderItem->itembrand;
$orderitem_quan = $data_orderItem->itemquan;
$orderitem_price = $data_orderItem->itemprice;
$orderitem_totalprice = $data_orderItem->totalPrice;
$arr = array(
"itemcode" => $orderitem_code,
"itemname" => $orderitem_name."-".$orderitem_brand,
"itemquan" => $orderitem_quan,
"itemprice" => $orderitem_price,
"total" => $orderitem_totalprice,
"action" => "<button class='btn btn-danger' id='orderRecord-delete' data-id='".$orderitem_medID."'><i class='fa fa-trash'></i></button>"
);
}
$dataTables = new DataTable();
$dataTables->fromArray($arr)->sendResponse();
}
}
Here's my Js
$(document).on('change', '#items', function(e) {
e.preventDefault();
var dropdown_val = $(this).val();
if(dropdown_val != null)
{
//Table For Order Items
$('#order_tbl').DataTable({
processing: true,
deferRender: true,
ajax: {
url: '/HPsys/walkin/orderWalkin',
method: 'POST',
data: { dropdown_id : dropdown_val }
},
columns: [
{ data : "itemcode" },
{ data : "itemname" },
{ data : "itemquan" },
{ data : "itemprice" },
{ data : "total" },
{ data : "action" },
]
});
}
else
{
}
});
Here's my View
<select class="form-control" id="items">
<option value="">-- Select Item --</option>
</select>
<hr>
<h2 class="text-center">Order Details </h2>
<table class="table" id="order_tbl">
<thead>
<tr>
<th>Item Code</th>
<th>Item Name</th>
<th>Quantity</th>
<th>Price</th>
<th>Total</th>
<th>Action</th>
</tr>
</thead>
</table>
If there's a vlog/tutorial/ or any recommendation please feel free to comment, I really appreciate that.
javascript mysql phalcon
javascript mysql phalcon
edited Nov 20 '18 at 5:41
koroku
asked Nov 20 '18 at 5:26
korokukoroku
136
136
@Phil yeah sure, my bad.
– koroku
Nov 20 '18 at 5:39
What debugging have you done? I'd start by looking in the browser's Network console... inspect the AJAX request and check what data its sending? FYI, you have no useful<option>
elements in your<select>
so I'm not sure what sort of value you expect
– Phil
Nov 20 '18 at 5:41
@Phil in my<option>
I append the dropdown using javascript , then what I am expecting is when I select one of the value in my<select>
it will appear in my DataTable
– koroku
Nov 20 '18 at 5:45
So, about that Network console...
– Phil
Nov 20 '18 at 5:46
1
@Phil ohh.. sorry my bad, my error only is the url of the API i used in dataTable for phalcon. I just review the documentation of that API then I get to that. that's it.
– koroku
Nov 22 '18 at 1:28
|
show 10 more comments
@Phil yeah sure, my bad.
– koroku
Nov 20 '18 at 5:39
What debugging have you done? I'd start by looking in the browser's Network console... inspect the AJAX request and check what data its sending? FYI, you have no useful<option>
elements in your<select>
so I'm not sure what sort of value you expect
– Phil
Nov 20 '18 at 5:41
@Phil in my<option>
I append the dropdown using javascript , then what I am expecting is when I select one of the value in my<select>
it will appear in my DataTable
– koroku
Nov 20 '18 at 5:45
So, about that Network console...
– Phil
Nov 20 '18 at 5:46
1
@Phil ohh.. sorry my bad, my error only is the url of the API i used in dataTable for phalcon. I just review the documentation of that API then I get to that. that's it.
– koroku
Nov 22 '18 at 1:28
@Phil yeah sure, my bad.
– koroku
Nov 20 '18 at 5:39
@Phil yeah sure, my bad.
– koroku
Nov 20 '18 at 5:39
What debugging have you done? I'd start by looking in the browser's Network console... inspect the AJAX request and check what data its sending? FYI, you have no useful
<option>
elements in your <select>
so I'm not sure what sort of value you expect– Phil
Nov 20 '18 at 5:41
What debugging have you done? I'd start by looking in the browser's Network console... inspect the AJAX request and check what data its sending? FYI, you have no useful
<option>
elements in your <select>
so I'm not sure what sort of value you expect– Phil
Nov 20 '18 at 5:41
@Phil in my
<option>
I append the dropdown using javascript , then what I am expecting is when I select one of the value in my <select>
it will appear in my DataTable– koroku
Nov 20 '18 at 5:45
@Phil in my
<option>
I append the dropdown using javascript , then what I am expecting is when I select one of the value in my <select>
it will appear in my DataTable– koroku
Nov 20 '18 at 5:45
So, about that Network console...
– Phil
Nov 20 '18 at 5:46
So, about that Network console...
– Phil
Nov 20 '18 at 5:46
1
1
@Phil ohh.. sorry my bad, my error only is the url of the API i used in dataTable for phalcon. I just review the documentation of that API then I get to that. that's it.
– koroku
Nov 22 '18 at 1:28
@Phil ohh.. sorry my bad, my error only is the url of the API i used in dataTable for phalcon. I just review the documentation of that API then I get to that. that's it.
– koroku
Nov 22 '18 at 1:28
|
show 10 more comments
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53386728%2fphalcon-php-select-option-value-post-in-table-using-datatable%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53386728%2fphalcon-php-select-option-value-post-in-table-using-datatable%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
@Phil yeah sure, my bad.
– koroku
Nov 20 '18 at 5:39
What debugging have you done? I'd start by looking in the browser's Network console... inspect the AJAX request and check what data its sending? FYI, you have no useful
<option>
elements in your<select>
so I'm not sure what sort of value you expect– Phil
Nov 20 '18 at 5:41
@Phil in my
<option>
I append the dropdown using javascript , then what I am expecting is when I select one of the value in my<select>
it will appear in my DataTable– koroku
Nov 20 '18 at 5:45
So, about that Network console...
– Phil
Nov 20 '18 at 5:46
1
@Phil ohh.. sorry my bad, my error only is the url of the API i used in dataTable for phalcon. I just review the documentation of that API then I get to that. that's it.
– koroku
Nov 22 '18 at 1:28