• 0
Sign in to follow this  
Ogro Lettiere

Erro ao enviar formulario ao DB

Question

Prezados,

Não sei se estou correto em str aqui, mas e que eu já vi, olhei, analisei. mas não acho erro.. desde scrit para envio do formulario para o DB...

 

se alguém pode me falar onde errei agradeço.

 

Formulario:

<?php include ("cabecalho.php"); ?>
<?php include ("conexao.php"); ?>


<div id="" class=" col-md-2">
    <figure>
        <img src="img/logo_five_site.png" width="200" alt=""/>
    </figure>

 

</div>
<div id="" class=" col-md-10">
    <h1>Relatório de Visita</h1>
</div>


<div id="" class=" col-md-2">

    <!--   Local Disponiivel para alguma coisa que não e necessário momento! -->

</div>

 

<div  class="col-md-10">

    <div class="row">

        <div>

            <form action="adiciona-relatorio-visita.php">
                <table class="table">

                   <tr>
                        <td>Cliente</td>
                        <td><input type="text" class="form-control" required=""  placeholder="Nome do Cliente" name="cliente"> </td>
                   </tr>
                   
                    <tr>
                        <td> Data </td>
                        <td> <input type="date"  class="form-control" required=""  name="data"></td>
                    </tr>
                   
                    <tr>
                        <td> Endereço </td>
                        <td> <input type="text"  class="form-control" required="" placeholder="endereço" name="endereco"></td>
                    </tr>

                    <tr>
                        <td> Numero </td>
                        <td> <input type="number"  class="form-control" required=""  placeholder="Numero" name="numero"></td>
                    </tr>

                    <tr>
                        <td> Bairro </td>
                        <td> <input type="text"  class="form-control" required=""  placeholder="Bairro" name="bairro"></td>
                    </tr>

                    <tr>
                        <td> Município </td>
                        <td> <input type="text"  class="form-control" required=""  placeholder="Município" name="municipio"></td>
                    </tr>

                    <tr>
                        <td> Contato </td>
                        <td> <input type="text"  class="form-control" required=""  placeholder="Contato" name="contato"></td>
                    </tr>
                    <tr>
                        <td> Colaborador </td>
                        <td> <input type="text"  class="form-control" required=""  placeholder="Colaborador" name="colaborador"></td>
                    </tr>
<!--
                    <tr>
                        <td> Colaborador </td>
                        <td>
                            <select    input type="text" class="form-control"  class="form-control" required=""  name="colaborador">
                                <option>  </option>
                                <option> Alexandre Letiere </option>
                                <option> Rogerio Otaguro </option>
                            </select>
                        </td>
                    </tr>

                    <hr>

                    <tr>
                        <td colspan="2">
                            <h3 id="h3formulario">Objetivo</h3>

                            <textarea class="form-control" rows="5" placeholder="Descreva o Objetivo de Sua Visita" name="objetivo">

                            </textarea>
                            <br>
                        </td>
                    </tr>

                    <tr>
                        <td colspan="2">
                            <h3 id="h3formulario">Apontamentos</h3>

                            <textarea class="form-control" rows="5" placeholder="Descreva os apontamentos  de Sua Visita!" name="apontamento">

                            </textarea>
                            <br>
                        </td>
                    </tr>

                        -->

                </table>


                <nav>
                    <a href="cadastroRelatorioVisita.php"><button  class="btn btn-block btn-primary"  type="submit"> Cadastrar </button></a>
                </nav>
                <br>

                <nav>
                    <a href="dasbord.php"><button class="btn btn-block btn-success" type="submit">Inicio</button></a>
                </nav>

            </form>
        </div>


    </div>
</div>

 

<?php
include'rodape.php';
?>


Função

 

<?php include("cabecalho.php"); ?>
<?php include("conexao.php"); ?>
<?php

function insereproduto($conexao, $cliente, $data, $endereco, $numero, $bairro, $municipio, $contato, $colaborador) {
    $query = "insert into relatorio_visita (cliente, data, endereco, numero, bairro, municipio, contato, colaborador) values
                                        ('{$cliente}', '{$data}','{$endereco}','{$numero}','{$bairro}','{$municipio}','{$contato}','{$colaborador}')";

    return mysqli_query($conexao, $query);
}

$cliente        = $_GET['cliente'];
$data           = $_GET['data'];
$endereco       = $_GET['endereco'];
$numero         = $_GET['numero'];
$bairro         = $_GET['bairro'];
$municipio      = $_GET['municipio'];
$contato        = $_GET['contato'];
$colaborador    = $_GET['colaborador'];


if (insereproduto($conexao, $cliente, $data, $endereco, $numero, $bairro, $municipio, $contato, $colaborador)) {
    ?>
    <p class="text-sucess"> Zona Azul usado na empresa - <?php echo $cliente; ?>, na data <?php echo $date ?> adicionado com Sucesso!</p>

    <br>
    <a href="cadastroRelatorioVisita.php"><button class="btn btn-block btn-primary" type="submit">Novo Cadastro</button></a>
    <br>
    <a href="dasbord.php"><button class="btn btn-block btn-success" type="submit">Inicio</button></a>


<?php } else { ?>
    $msg = mysqli_error($conexao);


    <?php
}
?>

 

Neste caso toda aparece o erro $msg = mysqli_error($conexao);

 

já não sei onde está pensei que era a conexão mas esta tudo funcionando nos ouros formularios...

Share this post


Link to post
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this