-2
我想追加或插入一个html输入到表的td。你知不知道怎么?如何将html输入插入到后端的返回表中?
这是我的HTML表单index.php
:
<table class="stack">
<thead class="tblthead">
<tr>
<th>Filename</th>
<th width="400">Date/Time</th>
<th width="300">Action</th>
</tr>
</thead>
<tbody id="importable">
</tbody>
</table>
这是我backend.php
,这是我返回的数据要到frontend
这是我index.php
。
case 'filerec':
$arr =[
":userID" => $_SESSION['loggedIn_PH'][0]['user_id'],
];
$query = "SELECT * FROM file_rec_tbl WHERE user_id=:userID ORDER BY file_id DESC";
$stmt = $con -> prepare($query);
$stmt -> execute($arr);
$data = $stmt -> fetchAll();
$table = '';
for($x = 0; $x < count($data); $x++) {
$table .= '<tr fileID="'.$data[$x]['file_id'].'">
<td>'.$data[$x]['file_name'].'</td>
<td>'.$data[$x]['file_datetime'].'</td>
<td>'.html('<input type="text"></input>')
</tr>';
}
exit ($table);
break;
I got an error to the last td. Can you please help me or suggest what might be a good solution to my problem.
哇惊人的感谢! –
我可以将css或属性添加到输入吗? –