In the code below, when I click on "Delete event" it gives an error that you need to select event (event ID).
Codewhereeventsareloaded:
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/YYYYHH:mm:ss'));$('#visualizar#start').val(event.start.format('DD/MM/YYYYHH:mm:ss'));$('#visualizar#end').text(event.end.format('DD/MM/YYYYHH:mm:ss'));$('#visualizar#end').val(event.end.format('DD/MM/YYYYHH:mm:ss'));$('#visualizar#color').val(event.color);$('#visualizar').modal('show');returnfalse;},
Button:
<aclass="btn btn-danger" type="button" href="deletar_evento.php">Excluir evento</a>
deletar_evento.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");
}
Celke's website: link