I wanted when the form was sent to the Bank, an alert would appear with something like "It was right to insert" if it did not say "Error sending your message".
<?php
if(!empty($_FILES['uploaded_file'])){
$username = 'root';
$password = '';
$connection = new PDO( 'mysql:host=localhost;dbname=bd', $username );
$query = "INSERT INTO denuncia (descricao, imagem, id_usuario, oque_descricao,id_bloco, id_denuncia_oque)
VALUES (:descricao, :imagem, :id_usuario, :oque_descricao, :id_bloco, :id_denuncia_oque)";
$statement = $connection->prepare($query);
$path = "img_denuncia/";
$path = $path . basename( $_FILES['uploaded_file']['name']);
if(move_uploaded_file($_FILES['uploaded_file']['tmp_name'], $path))
$valores = array();
$valores[':descricao'] = $_POST['descricao_denuncia'];
$valores[':imagem'] = $_FILES['uploaded_file']['name'];
$valores[':id_usuario'] = 2;
$valores[':oque_descricao'] = $_POST['oque_descricao'];
$valores[':id_bloco'] = $_POST['bloco_denuncia'];
$valores[':id_denuncia_oque'] = $_POST['id_denuncia_oque'];
$result = $statement->execute($valores);
}
?>
Here is the Form
<form id="caixa" class="center-block row col-xl-6" enctype="multipart/form-data" name="formulario" method="POST" action="">
<br>
<div class="row p-0 no-margin col-12 col-sm-12 col-md-12 col-lg-10 col-xl-12" >
<div class="form-group">
<label for="sel1">Bloco:</label>
<select class="form-control" name="bloco_denuncia" id="bloco">
<option value="1">Bloco - Computação</option>
<option value="2">Bloco - Mecânica</option>
<option value="3">Bloco - Química</option>
<option value="4">Bloco - Administrativo</option>
<option value="5">Biblioteca </option>
<option value="6">Ginásio </option>
<option value="7">Auditório</option>
<option value="0">Outros</option>
</select>
</div>
<div class="form-group">
<label for="sel1">O que:</label>
<select class="form-control" name="id_denuncia_oque" id="sel1">
<option value="1">Sala</option>
<option value="2">Banheiro(térreo)</option>
<option value="3">Banheiro(Superior)</option>
<option value="4">Labóratorio</option>
<option value="5">Coordenação</option>
<option value="6">Gabinete</option>
<option value="7">Telecom</option>
<option value="8">Outros</option>
</select>
</div>
<div class="form-group">
<label for="usr">Qual:</label>
<input type="text" class="form-control" id="usr" name="oque_descricao" placeholder="ex: ar-condicionado ">
</div>
</div>
<textarea id="form-control"class="noresize col-12 col-sm-12 mb-12 col-md-12 col-lg-10 col-xl-12 " name="descricao_denuncia" placeholder="Responda a denúncia aqui! " id="denuncia" rows="13">
</textarea>
<br>
<div class="row p-0 no-margin col-12 col-sm-12 col-md-12 col-lg-10 col-xl-12">
<div class="botao p-0 no-margin col-6 col-sm-6 mb-3 col-md-6 col-lg-2 col-xl-10">
<label class="file-upload btn btn-primary">
Escolha o arquivo... <input type="file" name="uploaded_file"/ accept="image/*">
</label>
<small class="form-text text-muted">As suas mensagens não serão totalmente anônimas.</small>
</div>
<div class="botao p-0 no-margin col-6 col-sm-6 mb-3 col-md-6 col-lg-10 col-xl-2 text-right ">
<input id="b_enviar" type="submit" class="btn btn-success" value="Enviar" name="enviar"/>
</div>insira o código aqui
</div>
</form>