-
Notifications
You must be signed in to change notification settings - Fork 1
/
editar_evento.php
101 lines (81 loc) · 3.58 KB
/
editar_evento.php
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
<?php
require_once('banco.php');
if (isset($_POST['salvar'])) {
$nomeEvento = $_POST['nome'];
$descricao = $_POST['descricao'];
$data = $_POST['data'];
$id = $_GET['id'];
if ($nomeEvento == "" || $nomeEvento == null) {
$erro = 'O campo nome do evento deve ser preenchido';
} else {
$query = "UPDATE evento SET nome='$nomeEvento', descricao='$descricao', data='$data' WHERE usuario_nick = '" . $_SESSION['user']['nick'] . "' AND id='$id'";
$insert = mysql_query($query, $connect);
if ($insert) {
$sucesso = 'Evento atualizado com sucesso!';
} else {
$erro = 'Não foi possível atualizar esse evento';
}
}
}
$query_select = "SELECT * FROM evento WHERE id= '" . $_GET['id'] . "'";
$select = mysql_query($query_select, $connect);
$array = mysql_fetch_array($select);
?>
<html>
<head>
<title>Guild Manager - Eventos</title>
<link rel="stylesheet" href="css/bootstrap.css">
<link href='https://fonts.googleapis.com/css?family=Titillium+Web:400,300,600' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.min.css">
</head>
<body>
<?php require_once "navbar.php" ?>
<div class="container">
<div class="panel panel-default">
<div class="panel-heading">Editar Evento</div>
<div class="panel-body">
<?php if (isset($erro)) { ?>
<div class="alert alert-danger" role="alert"><?= $erro ?></div>
<?php } ?>
<?php if (isset($sucesso)) { ?>
<div class="alert alert-success" role="alert"><?= $sucesso ?></div>
<?php } ?>
<form class="form-horizontal" method="post">
<input type="hidden" id="nome" name="nome" value="<?= $array['nome'] ?>">
<div class="form-group">
<label for="nome" class="col-sm-2 control-label">Nome</label>
<div class="col-sm-10">
<input type="text" class="form-control" id="nome" name="nome" placeholder="Nome"
value="<?= $array['nome'] ?>">
</div>
</div>
<div class="form-group">
<label for="descricao" class="col-sm-2 control-label">Descrição</label>
<div class="col-sm-10">
<input type="text" class="form-control" id="descricao" name="descricao" placeholder="Descricao"
value="<?= $array['descricao'] ?>">
</div>
</div>
<div class="form-group">
<label for="data" class="col-sm-2 control-label">Data</label>
<div class="col-sm-10">
<input type="datetime-local" class="form-control" id="data" name="data" placeholder="Data"
value="<?= $array['data'] ?>">
</div>
</div>
<hr>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<a href="/guild/evento.php" class="btn btn-default">Voltar</a>
<button type="submit" class="btn btn-default" name="salvar">Salvar Edição</button>
</div>
</div>
</form>
</div>
</div>
</div>
<script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script>
<script src="js/bootstrap.js"></script>
<script src="js/index.js"></script>
</body>
</html>