At the time of registering the php form with an image it only sends the image to the folder but does not register the data in the bank

0

This is my form

<form method="post" id="show" action="inserir/inserir_show.php" enctype="multipart/form-data">
                    <h4>Nome do show</h4>
                    <div class="form-group">
                        <input type="text" class="form-control" name="nome" id="inputEmail" required="">
                    </div>
                    <h4>Diretor do show</h4>
                    <div class="form-group">
                        <input type="text" class="form-control" name="diretor" id="inputEmail" required="">
                    </div>
                    <h4>Foto do show</h4>
                    <div class="form-group">
                        <input type="file" class="form-control" name="image" id="inputEmail" required="">
                    </div>
                    <h4>Frase</h4><!--frase-->
                    <div class="form-group">
                        <input type="text" class="form-control" name="frase" id="inputEmail" required="">
                    </div>
                    <h4>Descrição</h4><!--descrição-->
                    <div class="form-group">
                        <input type="text" class="form-control" name="descricao" id="inputEmail" required="">
                    </div>
                    <h4>Data do show</h4>
                    <div class="form-group">
                        <input type="date" class="form-control" name="data" id="inputEmail" required="">



                    </div>
                    <h4>Local do show</h4>
                    <div class="form-group">
                        <input type="text" class="form-control" name="local" id="inputEmail" required="">
                    </div>
                    <h4>Categoria do show</h4>
                    <div class="form-group">
                        <input type="text" class="form-control" name="categoria" id="inputEmail" required="">
                    </div>

                    <button type="submit" class="btn btn-primary">Enviar</button>

                </form>

And the insert into the bank

<?php

include "conecta.php";

$nome = $_POST['nome'];
$diretor = $_POST['diretor'];
$data = $_POST['data'];
$descricao = $_POST['descricao'];
$frase = $_POST['frase'];
$local = $_POST['local'];
$categoria = $_POST['categoria'];
$foto = $_FILES['image']['name'];
$target = "img/" .basename($_FILES['image']['name']);



    $cadastro_show = "INSERT INTO show(nomeShow, diretorShow, dataShow, descricaoShow, fraseShow, localShow, categoriaShow, fotoShow) VALUES ('$nome', '$diretor', '$data', '$descricao', '$frase', $local', '$categoria', '$foto')";

    mysqli_set_charset($link, x'utf8');

    mysqli_query($link, $cadastro_show);

    if (move_uploaded_file($_FILES['image']['tmp_name'], $target)) {
     echo"<script language='javascript' type='text/javascript'>alert('Cadastrado com sucesso :)');window.location.href='../shows.php';</script>";
}else{
     echo"<script language='javascript' type='text/javascript'>alert('Houve um Erro ao cadastrar o show');window.location.href='../shows.php';</script>";
}


mysqli_close($link);

?>

The image that I select in the form sends to the folder "img /" and the message appears that has registered but does not send any data to the bank, can anyone help me?

    
asked by anonymous 28.11.2018 / 18:55

0 answers