у меня есть 3 формы здесь query.php
для обработки запроса таблицы,
salesorder_table.php
для вывода таблицы и data_fetch_table
для инициализации salesorder_table
,
моя проблема, когда я пытаюсь var_dump $SALESORDER_CODE
он дал мне пустую строку и icant выполнил мой запрос из-за того, что мне делать?
query.php
$SALESORDER_CODE=$_POST["SALESORDER_CODE"];
var_dump($SALESORDER_CODE);
$salesorder=mysqli_query($link,"SELECT* FROM salesorder WHERE
USER_ID='".$display_userid."' AND SALESORDER_CODE = '".$SALESORDER_CODE."'");
salesorder_table.php
<?phpinclude ("query.php");
echo '
<table id="example1" class="datatable table table-bordered table-striped" >
<thead><tr class="default">
<th class="display_invisible">ID</th>
<th></t h>
<th>Item Code <i class="fa fa-sort" aria-hidden="true"></i> </th>
<th>Quantity <i class="fa fa-sort" aria-hidden="true"></i></th>
<th>Rate <i class="fa fa-sort" aria-hidden="true"></i></th>
<th>Total <i class="fa fa-sort" aria-hidden="true"></i></th>
</tr>
</thead>
<tbody>';
while($sorow=mysqli_fetch_array($salesorder)){
$SALESORDER_ID=$sorow["SALESORDER_ID"];
$SALESORDER_QUANTITY=$sorow["SALESORDER_QUANTITY"];
$SALESORDER_UNITPRICE=$sorow["SALESORDER_UNITPRICE"];
$SALESORDER_AMOUNT=$sorow["SALESORDER_AMOUNT"];
$ITEM_ID=$sorow["ITEM_ID"];
$total= number_format($SALESORDER_AMOUNT, 2);
$itemquery=mysqli_query($link,"select * from item where ITEM_ID = '".$ITEM_ID."'");
while($itemrow=mysqli_fetch_array($itemquery)){
$ITEM_NAME=$itemrow["ITEM_NAME"];
}?>
<tr class="datatablefetch">
<td class="display_invisible"><?php echo $SALESORDER_ID ?></td>
<td class="text-center">
<div class="dropdown">
<button class="btn btn-default dropdown-toggle" type="button" data-toggle="dropdown">
<span class="caret"></span></button>
<ul class="dropdown-menu">
<li class="bg-success"><a href="" title="Edit Customer Info" data-toggle="modal" data-target="#editso">Edit</a></li>
<li class="bg-danger"><a data-toggle="modal" data-target="#deleteitemmodal" href="" title="Inactive Customer ">Delete</a></li>
</ul>
</div>
</td>
<td class="text-center"><?php echo $ITEM_NAME; ?></td>
<td class="text-center"><?php echo $SALESORDER_QUANTITY; ?></td>
<td class="text-center"><?php echo $SALESORDER_UNITPRICE; ?></td>
<td class="text-center
<?php
if($ITEM_ID != "3"){
echo 'amount';
}else{
echo 'discount';
}?>"><?php echo $total;?></td></tr>
<?php
}
echo'
</tbody>
<tfoot>
<tr class="default">
<th class="display_invisible">ID</th>
<th></th>
<th>Item Code <i class="fa fa-sort" aria-hidden="true"></i> </th>
<th>Quanitity <i class="fa fa-sort" aria-hidden="true"></i></th>
<th>Rate <i class="fa fa-sort" aria-hidden="true"></i></th>
<th>Total <i class="fa fa-sort" aria-hidden="true"></i></th>
</tr>
</tfoot>
</table>';?>
fetch_data_table.js
function fetch_data(){
setTimeout(function(){
SALESORDER_CODE = "SALESORDER_CODE";
$.ajax({
type: "POST",
data: SALESORDER_CODE,
url: "php/salesorder_table.php",
cache: false,
success: function(data){
$("#tabledata").html(data);
}
});
});
}
$(document).ready(function() {
fetch_data();
})
Задача ещё не решена.
Других решений пока нет …