type == "Not classified"
结果包含长度为n的数据。当我单击该块时,我需要从{{#if results}}
<form method="post">
<div class="table">
<table border="1" style="width:100%;background-color:white;color:black;padding-top:10px;">
<tr>
<tr>
<th>RegNo</th>
<th>Name</th>
<th>Department</th>
<th>Mail ID</th>
<th>Phone No</th>
<th></th>
<th></th>
</tr>
{{#each results}}
<tr>
<td name="id" > {{ID}}</td>
<td>{{name}}</td>
<td>{{department_name}}</td>
<td name="email" > {{email_id}} </td>
<td>{{phone_num}}</td>
<td><button style="border:1;" class="button" formaction="block">Block</button></td>
<td><button style="border:1;" class="button" formaction="remove">Remove</button></td>
</tr>
</tr>
</form>
{{/each}}
</table>
{{else}}
<div> No User exists</div>
{{/if}}
获取两段数据,因此在服务器中:
<td>
但这不起作用。 router.post('/block', ensureAutheticated, (req, res) => {
console.log(req.body);
var regno = req.body.id;
var email = req.body.email;
console.log(regno, email);
});
无法在其中输入名称。这该怎么做?单击该块将仅向服务器返回该行的数据或表数据。
答案 0 :(得分:0)
最简单的方法是添加两个隐藏的输入,因为TD无法通过表单传递值
<input type="hidden" name="id" value="{{ID}}" />
<input type="hidden" name="email" value="{{email_id}}" />