|
|
|
ขอความช่วยเหลือหน่อยนะคะ คือ ส่งค่า ตัวแปรไป เพื่อเเสดงที่ modal popup ไม่ได้ [ ใช้งานกับ Bootstrap ] |
|
|
|
|
|
|
|
Code (PHP)
$query = "select mat_id , mat_name , color_name , brand_name , typemat_name , mat_amount , costprice , mat_point_order , unit_name from material , color , brand , type_material , unit WHERE material.color_id = color.color_id AND material.brand_id = brand.brand_id AND material.typemat_id = type_material.typemat_id AND material.unit_id = unit.unit_id order by mat_name ASC LIMIT $offset OFFSET $begin";
// or die(mysql_error());
$result = mysql_query($query);
echo "<table class='table table-striped table-bordered'>";
echo "<tr>
<th><div align='center'>รหัสวัสดุ</div></th>
<th><div align='center'>รหัสวัสดุ</div></th>
<th><div align='left'>ชื่อวัสดุ</div></th>
<th><div align='left'>ประเภทวัสดุ</div></th>
<th><div align='center'>รายละเอียด</div></th>
<th><div align='center'>การจัดการ</div></th>
</tr>";
$i=1;
if($page > 1)
{
$x = ($p_size*($page-1)) + 1;
}
while($row = mysql_fetch_array( $result ))
{
$matids=$row[0];
echo "<tr>";
echo "<td>".$i++."</td>";
echo '<td align="center"><font color="#663300">' . $row['mat_id'] . '</font></td>';
echo '<td align="left"><font color="#663300">' . $row['mat_name'] . '</font></td>';
echo '<td align="left"><font color="#663300">' . $row['typemat_name'] . '</font></td>';
echo '<td align="center"><font color="#663300"> ';
?>
<table>
<tr>
<td>
<a data-id="<?php echo $row['mat_id'];?>" class="open-AddBookDialog btn btn-primary btn-sm" data-toggle="modal" data-target="#myModal" onclick="setval(<?php echo $row['mat_id'];?>);">view</a>
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 class="modal-title" id="myModalLabel">รายละเอียดเพิ่มเติม</h4>
</div>
<div class="modal-body">
<!-- <input type="text" id="mat_id" /> -->
<table>
<tr>
<th></th>
<th>รูปภาพวัสดุ</th>
<th>รหัสวัสดุ</th>
<th>ชื่อวัสดุ</th>
<th>สี</th>
<th>ยี่ห้อ</th>
<th>ประเภทวัสดุ</th>
<th>ราคาต้นทุน (บาท)</th>
<th>จำนวน</th>
<th>จุดสั่งซื้อ</th>
<th>หน่วยนับ</th>
</tr>
<tr>
<?php
echo "<td></td>";
echo '<td ><font color="#663300"><img src="../sc/img/'.$row['mat_id'].'.jpg" class="magnify" style="width:150px;height:150px;"></font></td>';
echo '<td align="center"><font color="#663300">' . $row['mat_id'] . '</font></td>';
echo '<td align="left"><font color="#663300">' . $row['mat_name'] . '</font></td>';
echo '<td align="left"><font color="#663300">' . $row['color_name'] . '</font></td>';
echo '<td ><font color="#663300">' . $row['brand_name'] . '</font></td>';
echo '<td ><font color="#663300">' . $row['typemat_name'] . '</font></td>';
echo '<td align="right"><font color="#663300">' . $row['costprice'] . '</font></td>';
echo '<td align="right"><font color="#663300">' . $row['mat_amount'] . '</font></td>';
echo '<td align="right"><font color="#663300">' . $row['mat_point_order'] . '</font></td>';
echo '<td align="center"><font color="#663300">' . $row['unit_name'] . '</font></td>';
echo '<td align="center"><font color="#663300">';
?>
</tr>
</table>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
</td>
</tr>
</table>
<?php
echo '</font></td>';
echo '<td><center>
<font color="#663300">
<a href="material_edit.php?id=' . $row['mat_id'] . '&mat_name='.$row['mat_name'].'&color_id='.$row['color_name']. '&brand_id='.$row['brand_name'].'&typemat_id='.$row['typemat_name'].'&mat_point_order='.$row['mat_point_order'].'&mat_amount='.$row['mat_amount'].'&unit_id='.$row['unit_name'].'&costprice='.$row['costprice'].'">
<span class="glyphicon glyphicon-edit" type="submit" formaction="material_edit.php"></a>
</font>
<font color="#663300">
<a href="material_delete.php?id=' . $row['mat_id'] . '" class="delete"><span class="glyphicon glyphicon-trash"></a>
</font>
</td>';
echo "</tr>";
}
echo "</table>";
?>
</div>
</div>
</div>
</div>
</section><!-- ปิด sectionลองบน -->
</section><!-- ปิด sectionบนสุด -->
<script type="text/javascript">
$(document).ready(function() {
$('#myModal').on('show.bs.modal', function (event) {
var button = $(event.relatedTarget);
var id= button.data('id');
var modal = $(this);
modal.find('#mat_id').val(id);
});
});
</script>
ขอความช่วยเหลือหน่อยนะคะ คือ ส่งค่า ตัวแปรไป เพื่อเเสดงที่ modal popup ไม่ได้ [ ใช้งานกับ Bootstrap ] ไม่ว่าจะview ที่ id ไหนก็ตามมันจะโชว์เเค่ id เเรกของหน้า page เเรก
Tag : PHP
|
|
|
|
|
|
Date :
2016-07-22 15:01:25 |
By :
POMP |
View :
1432 |
Reply :
2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Code (PHP)
<a data-id="<?php echo $row['mat_id'];?>" class="open-AddBookDialog btn btn-primary btn-sm" data-toggle="modal" data-target="#myModal<?php echo $row['mat_id'];?>" onclick="setval(<?php echo $row['mat_id'];?>);">view</a>
<div class="modal fade" id="myModal<?php echo $row['mat_id'];?>" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 class="modal-title" id="myModalLabel">รายละเอียดเพิ่มเติม</h4>
</div>
<div class="modal-body">
<table>
<tr>
<th></th>
<th>รูปภาพวัสดุ</th>
<th>รหัสวัสดุ</th>
<th>ชื่อวัสดุ</th>
<th>สี</th>
<th>ยี่ห้อ</th>
<th>ประเภทวัสดุ</th>
<th>ราคาต้นทุน (บาท)</th>
<th>จำนวน</th>
<th>จุดสั่งซื้อ</th>
<th>หน่วยนับ</th>
</tr>
<tr>
<?php
echo "<td></td>";
echo '<td ><font color="#663300"><img src="../sc/img/'.$row['mat_id'].'.jpg" class="magnify" style="width:150px;height:150px;"></font></td>';
echo '<td align="center"><font color="#663300">' . $row['mat_id'] . '</font></td>';
echo '<td align="left"><font color="#663300">' . $row['mat_name'] . '</font></td>';
echo '<td align="left"><font color="#663300">' . $row['color_name'] . '</font></td>';
echo '<td ><font color="#663300">' . $row['brand_name'] . '</font></td>';
echo '<td ><font color="#663300">' . $row['typemat_name'] . '</font></td>';
echo '<td align="right"><font color="#663300">' . $row['costprice'] . '</font></td>';
echo '<td align="right"><font color="#663300">' . $row['mat_amount'] . '</font></td>';
echo '<td align="right"><font color="#663300">' . $row['mat_point_order'] . '</font></td>';
echo '<td align="center"><font color="#663300">' . $row['unit_name'] . '</font></td>';
echo '<td align="center"><font color="#663300">';
?>
</tr>
</table>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
|
|
|
|
|
Date :
2016-07-23 08:21:03 |
By :
fossil31 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 05
|