Insert data into the database

1

How could I insert the image data below into the database I created. is not giving and only inserted those 0.

thisisthecode

<html><body><head><metacharset="UTF-8">
            <title>Sistema de  Inventário</title>

            <style>
         html { 
             font: 13px Arial, sans-serif; 
             width: 100%; 

             margin-top: 5%; 
         } 
         label { 
             display: block; 
             clear: both; 
             width: 200px; 
             color: black; 
             font-size: 18px; 
         } 

         input { 
             border: 1px solid #E6E6FA;
             padding-left: 5px; 
         } 

         input[type="submit"],input[type="reset"] { 
             width: 100px; 
             height: 30px; 
             background: #32CD32; 
             color: white; 
             margin-left: 10px; 
         } 
        fieldset{ 
             border: 1px solid #E6E6FA; 
             color: black; 
             font-size: 20px; 

         } 
       .form_inp { 
             float: center; 
             margin-top: 17px; 
             height: 30px;
             width:  18px 
             clear: both; 
         }

         hr {
            border: 1px solid #E6E6FA; 
         }

            </style>


    <title>Sistema deInventário</title>
    <style>
         html { 
             font: 13px Arial, sans-serif; 
             width: 990px; 
             margin-left: 10%;
             margin-top: 5%; 
         } 

         .blue { 
              color: #0000FF;
              font-size: 14px;
              font-family: verdana;
         } 

         .red { 
              color: red; 
              font-size: 14px;
              font-family: verdana;
         } 

         label { 
             display: block; 
             clear: both; 
             width: 200px; 
             color: black; 
             font-size: 13px; 
         } 

         input { 
             border: 1px solid #E6E6FA;
             padding-left: 5px; 
         } 

         input[type="submit"],input[type="reset"] { 
             width: 100px; 
             height: 30px; 
             background: #32CD32; 
             color: white; 
             margin-left: 10px; 
         } 

         fieldset{ 
             border: 1px solid #E6E6FA; 
             color: black; 
             font-size: 20px; 
         } 

         .form_inp { 
             float: right; 
             margin-top: -17px; 
             height: 13px;
             clear: both; 
         }

         hr {
            border: 1px solid #E6E6FA; 
         }
    </style>





    <form method="post" action="cadastrando.php" onSubmit="">
        <fieldset>
            <legend>Sistema de Inventário</legend><br />

            <label class="borda">Setor: </label>
            <input class="form_inp" type="text" name="setor" size="30" required><br />

            <label class="borda">Usuário:</label>
            <input class="form_inp" type="text" id="usuario" name="usuario" size="30" required><br />

            <label class="borda">O/S :</label>
            <input class="form_inp" type="text" name="os" size="30" required><br /><br />

            <label class="borda">Hd : </label>
            <input  class="form_inp"type="text"  name="hd" size="30" required><br />                        
            <hr />          
            <label class="borda">Memória:</label>
            <input class="form_inp" type="text" id="" name="memoria" size="30" required><br />

            <label class="borda">Processador: </label>
            <input class="form_inp" type="text" id="processador"  name="processador" size="30" required><br /><br />
            <hr />
            <label class="borda">Cd/Dvd: </label>
            <select class="form_inp"  name="cd"> 
                <option value="Sim">Sim</option> 
                <option value="Não">Não</option> 
            </select>

            <br />

            <label class="borda">Placa Mãe: </label>
            <input class="form_inp" type="text" id="placam" name="placam" size="30" required><br />

            <label class="borda">HostName: </label>
            <input class="form_inp"type="text" id="host" name="host" size="30" required><br /><br />

            <label class="borda">Monitor/Patrimônio/Marca/Modelo: </label>
            <input class="form_inp" type="text" id="monitor" name="monitor" size="30" required><br />

            <label class="borda">Nobreak/Patrimônio/Marca/: </label>
            <input class="form_inp" type="text" id="nobreak" name="nobreak" size="30" required><br />

            <label class="borda">Placa de Rede : </label>
            <input class="form_inp" type="text" id="placar" name="placar" size="30" required><br />

            <label class="borda">Placa de Vídeo: </label>
            <input class="form_inp" type="text" id="placav" name="placav" size="30" required><br />

            <hr />
            <input type="submit" style="float: right;" value="Cadastrar" >
            <input type="reset" style="float: right;" value="Limpar">

        </fieldset>
    </form>

    <?php
        if($_SERVER['REQUEST_METHOD'] == 'POST') {
        print_r($_POST);
        $setor=$_POST['setor'];
        $usuario=$_POST['usuario'];
        $hd=$_POST['hd'];
        $memoria=$_POST['memoria'];
        $processador=$_POST['processador'];
        $cd=$_POST['cd'];
        $placam=$_POST['placam'];
        $host=$_POST['host'];
        $monitor=$_POST['monitor'];
        $nobreak=$_POST['nobreak'];
        $placar=$_POST['placar'];
        $placav=$_POST['placav'];
        $sql="INSERT INTO setor(setor,usuario,hd,memoria,processador,cd,placam,host,monitor,nobreak,placar,placav) VALUES('$setor','$usuario','$hd','$memoria','$processador','$cd','$placam','$host','$monitor','$nobreak','$nobreak','$placav')";
        $resultado_cadastro = mysqli_query($link,$sql);
    }

        ?>
    </head>
</body>
</html>

and this one

<html>
   <head><title>Cadastrando...</title></head>
    <body>

   <?php

session_start();
    $servidor = "localhost";
    $usuario = "root";
    $senha = "";
    $dbname = "cadastro";

    //Criar a conexao

        error_reporting(0);
    $link = new mysqli ("localhost", "root", "", "cadastro");
     if($link->connect_errno){
         echo"Nossas falhas local experiência ..";
         exit();
     }  

?>
    </body>
</html>
    
asked by anonymous 22.12.2016 / 22:15

1 answer

0

As I understand your connection is not on the same page, you do not care where you try to enter the data, try the following, and see if there is any error:

...
<?php
error_reporting(-1);
ini_set('display_errors', 'On');

//Criar a conexao
$link = new mysqli ("localhost", "root", "", "cadastro");
if($link->connect_errno){
     echo"Nossas falhas local experiência ..";
     exit();
}

if($_SERVER['REQUEST_METHOD'] == 'POST') {
        $setor=$_POST['setor'];
        $usuario=$_POST['usuario'];
        $hd=$_POST['hd'];
        $memoria=$_POST['memoria'];
        $processador=$_POST['processador'];
        $cd=$_POST['cd'];
        $placam=$_POST['placam'];
        $host=$_POST['host'];
        $monitor=$_POST['monitor'];
        $nobreak=$_POST['nobreak'];
        $placar=$_POST['placar'];
        $placav=$_POST['placav'];
        $sql="INSERT INTO setor(setor,usuario,hd,memoria,processador,cd,placam,host,monitor,nobreak,placar,placav) VALUES('$setor','$usuario','$hd','$memoria','$processador','$cd','$placam','$host','$monitor','$nobreak','$nobreak','$placav')";
        $resultado_cadastro = mysqli_query($link,$sql);
}

NOTE: you also have error_reporting(0) , so you do not see the error messages when you are developing, put what I put up and see what you give

    
22.12.2016 / 22:26