Undefined index: id
Publicado por Angel (12 intervenciones) el 01/01/2021 21:53:28
Porque recivo este error (Undefined index: id ) en el archivo php "delete_register"?
Este es el codigo PHP (con blade):
y este es el archivo "delete_register.php":
Este es el codigo PHP (con blade):
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<table class="table-bordered">
<thead>
<tr>
<th scope="col" style="text-align: center">#</th>
<th scope="col" style="text-align: center">Name</th>
<th scope="col" style="text-align: center">Email</th>
<th scope="col" style="text-align: center">Password</th>
<th scope="col" style="text-align: center">remember_token</th>
<th scope="col" style="text-align: center">created_at</th>
<th scope="col" style="text-align: center">updated_at</th>
<th scope="col" style="text-align: center">Acciones</th>
</tr>
</thead>
<tbody>
@foreach($registers as $register)
<tr>
<th class="col" style="width: auto" scope="col">{!! $register->id !!}</th>
<th class="col" style="width: auto" scope="col">{!! $register->name !!}</th>
<th class="col" style="width: auto" scope="col">{!! $register->email !!}</th>
<th class="col" style="width: auto" scope="col">{!! $register->password !!}</th>
<th class="col" style="width: auto" scope="col">{!! $register->remember_token !!}</th>
<th class="col" style="width: auto" scope="col">{!! $register->created_at !!}</th>
<th class="col" style="width: auto" scope="col">{!! $register->updated_at !!}</th>
<th class="col" style="width: auto" scope="col">
<p><a href="delete_register.php?id={!! $register->id !!}">Borrar</p></a>
<p><a href="edituser?id={!! $register->id !!}">Editar</p></a>
</th>
</tr>
@endforeach
</tbody>
</table>
y este es el archivo "delete_register.php":
1
2
3
4
5
6
7
8
9
<?php
use Illuminate\Support\Facades\DB;
$id= $_GET["id"];
DB::delete('DELETE FROM users where id = ?', [1, $id]);
?>
Valora esta pregunta


0