【发布时间】:2021-09-03 18:52:27
【问题描述】:
@extends('layouts.app')
@section('content')
<body>
<button class="btn" onclick="deleteSelected()">delete</button>
<table class="table">
<thead>
<tr>
<th scope="col">
<input type="checkbox" id="all" onclick="chkd()">
</th>
<th scope="col">id</th>
<th scope="col">title</th>
<th scope="col">Paragraph</th>
</tr>
</thead>
@foreach ($categories as $categorie)
<tbody>
<tr>
<td>
<input type="checkbox" class="ss" value="{{ $categorie->id }}" onclick="deleteSelected()">
</td>
<th scope="row">{{ $categorie->id }}</th>
<td>{{ $categorie->Title }}</td>
<td>{{ $categorie->Paragraph }}</td>
<form action={{ route('categorie.destroy', $categorie->id) }} method="POST">
@csrf
@method('DELETE')
<td>
<button id="deleteRow" class="btn btn-danger" type="submit" style="display: none">
delete
</button>
</form>
<button class="btn btn-warning"> <a href={{ route('edit', $categorie->id) }}>edit</a> </button>
</td>
</tr>
</tbody>
@endforeach
</table>
</body>
@endsection
这是我的观点,当我选中一个复选框并按下按钮删除时,我希望删除该行,或者当我选中所有行时,我想删除所有行
【问题讨论】:
-
表单元素进入inside
<form>...</form>(除非有form属性)。<a href在<button>中没有多大意义
标签: php html controller laravel-blade laravel-8