|
|
|
รบกวนหน่อยค่ะ จะส่งค่า array ใน Datatable ไปในaction form ยังไงให้ค่าแสดงตามมา |
|
|
|
|
|
|
|
รบกวนหน่อยค่ะ จะส่งค่า array ใน Datatable ไปในaction form ยังไงให้ค่าออก
ลอง Print_f แล้วค่าไม่ออกเลยค่ะ
Code (PHP)
<form id="form1" action="process.php" method="post" >
<table id="example" class="table table-bordered table-hover" >
<thead>
<tr>
<th>No</th>
<th>Code</th>
<th>Description</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<?php
$sql="SELECT count(id_data ) FROM t_data WHERE (name = '$name') ";
$query=odbc_exec($link,$sql);
$num=odbc_result($query,1);
$sql_a="SELECT * FROM t_data WHERE (name = '$name') ";
$query1=odbc_exec($link,$sql_a);
for($p=1;$p<=$num;$p++) {
$rows=odbc_fetch_array($query1);
$id = $rows['id'];
$id_a = $rows['id_a'];
$txt = $rows['txt'];
$name = $rows['name'];
?>
<tr>
<td> </td>
<td><?php echo $id; ?></td>
<td><?php echo $name; ?></td>
<td align = "center"><input type="checkbox" name="r2[]" id="r2[]" value="<?php echo $id_a; ?>" ></td>
<input type="hidden" name="user" id="user" value="<?php echo $user; ?>">
</tr>
<?php
}
?>
</tbody>
</table>
<button type="submit" id="submit" name="submit" class="btn btn-success ">
</form>
<script>
$(function () {
$('#example').DataTable({
"paging": true,
"lengthChange": false,
"searching": false,
"ordering": true,
"info": true,
"autoWidth": false,
"responsive": true,
});
});
</script>
process.php
print_r($_POST);
Tag : PHP, HTML, CSS, JavaScript, Action Script, Ajax
|
ประวัติการแก้ไข 2021-11-09 14:10:32
|
|
|
|
|
Date :
2021-11-09 14:09:17 |
By :
mewhappy |
View :
552 |
Reply :
6 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
แสดงยังไงครับ
|
|
|
|
|
Date :
2021-11-10 19:29:30 |
By :
mongkon.k |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Code (PHP)
if($_POST['r2']) {
echo '<pre>';
print_r($_POST['r2'];
echo '</pre>';
for ($i = 0; $i < count($_POST['r2']); $i++) {
echo '<br>' . $_POST['r2'][$i];
}
}
|
|
|
|
|
Date :
2021-11-10 20:47:59 |
By :
sleeplesscat |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
เอา id="r2[]" ออก
<input type="checkbox" name="r2[]" value="<?php echo $id_a; ?>" >
ลบ <input type="hidden" name="user" id="user" value="<?php echo $user; ?>"> ออก
แล้ว debug->print_r($_POST) หรือ var_dump($_POST)
|
|
|
|
|
Date :
2021-11-11 08:07:19 |
By :
Guest |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 00
|