0
In the code below, when I click on "Delete event" gives an error that you need to select the event(event ID).
Code where events are loaded:
eventClick: function(event) {
$('#visualizar #id').text(event.id);
$('#visualizar #id').val(event.id);
$('#visualizar #title').text(event.title);
$('#visualizar #title').val(event.title);
$('#visualizar #start').text(event.start.format('DD/MM/YYYY HH:mm:ss'));
$('#visualizar #start').val(event.start.format('DD/MM/YYYY HH:mm:ss'));
$('#visualizar #end').text(event.end.format('DD/MM/YYYY HH:mm:ss'));
$('#visualizar #end').val(event.end.format('DD/MM/YYYY HH:mm:ss'));
$('#visualizar #color').val(event.color);
$('#visualizar').modal('show');
return false;
},
Knob:
<a class="btn btn-danger" type="button" href="deletar_evento.php">Excluir evento</a>
deletar_event.php:
<?php
session_start();
include_once("conexao.php");
$id = filter_input(INPUT_GET, 'id', FILTER_SANITIZE_NUMBER_INT);
if(!empty($id)){
$result_events = "DELETE FROM events WHERE id='$id'";
$resultado_events = mysqli_query($conn, $result_usuario);
if(mysqli_affected_rows($conn)){
$_SESSION['msg'] = "<div class='alert alert-success' role='alert'>Evento excluído com sucesso!<button type='button' class='close' data-dismiss='alert' aria-label='Close'><span aria-hidden='true'>×</span></button></div>";
header("Location: index.php");
}else{
$_SESSION['msg'] = "<div class='alert alert-danger' role='alert'>Erro ao excluír evento!<button type='button' class='close' data-dismiss='alert' aria-label='Close'><span aria-hidden='true'>×</span></button></div>";
header("Location: index.php");
}
}else{
$_SESSION['msg'] = "<div class='alert alert-danger' role='alert'>É necessário selecionar um evento!<button type='button' class='close' data-dismiss='alert' aria-label='Close'><span aria-hidden='true'>×</span></button></div>";
header("Location: index.php");
}
Site do Celke: https://celke.com.br/artigo/como-editar-um-evento-no-fullcalendar-com-janela-modal-do-bootstrap
You are not passing the ID in the URL, the correct is
<a href="deletar_inscricao.php?id=<SEU-ID>"><button class="btn btn-danger">Excluir
evento</button></a>
– Valdeir Psr
What do you mean my ID? I’m dumb...
– user109458
The
<SEU-ID>
is the ID of the event you wish to delete, for exampledeletar_inscricao.php?id=3
– Valdeir Psr
But, for example, the user(me) would open the event to edit. Isn’t there any way he could read the id by himself? Put your answer so I can evaluate it as useful!
– user109458
If you do not pass the ID parameter in the URL, PHP will not be able to identify the event the user wants to remove.
– Valdeir Psr
Ah... never mind. But thanks man! you helped me a lot gave an enlightened and also now at least he is excluding, what before did not do...
– user109458