-3
connection file
<?php
   $servidor = "dsadasd.com.br";
   $usuario = "ttt";
   $senha = "ttt";
   $dbname = "cadastro";
   //Criar a conexao
   $conn = mysqli_connect($servidor, $usuario, $senha, $dbname);
   if(!$conn){
       die("Falha na conexao: " . mysqli_connect_error());
   }else{
       //echo "Conexao realizada com sucesso";
   }      
?>
index.html
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" type="text/css" href="estilos.css" media="screen">
   </head>
            <title>Central de Matrículas - Bem me quer</title>
<body>
<body background="http://www.palmeiradasmissoes-rs.com.br/new/city.png" bgproperties="fixed">
<?php
    // Inclui o arquivo com a função valida_cpf
    include('valida-cpf.php');
    session_destroy();
    ?>  
<div id="area">
    <form id="formulario" autocomplete="off" method="post" ACTION="grv_matriculas.php">
    <fieldset>
            <script language='JavaScript'>
                function only_number(){
                    if(event.keyCode<48 || event.keyCode>57)
                    event.returnValue=false;
                }
                function valida_cpf(){
                    // Verifica o CPF
                    if ( valida_cpf( 'cpf' ) 
                        <hr> CPF OK </hr>
                    event.returnValue=false;
                }
            </script>
            <legend>Formulário</legend>
            <br><label>Nome do aluno:</label><br><input class=longo type="text" name="aluno" required placeholder="Nome completo.">
            <br><label>CPF do aluno:</label><br><input class=curto type="number" name="cpf" onchange='valida_cpf()' required placeholder="Informe o cpf.">
            <br><label>Nome do responsavel:</label><br><input class=longo type="text" name="responsavel" required placeholder="Informe nome completo responsavel">
            <br><label>Endereço:</label><br>
               <input class=longo type="text" name="endereco" required placeholder="Informe endereço completo do responsavel.">
            <br><label>Telefone Celular:</label><br>
               <input class=curto type="number" name="fone" required placeholder="Informe o número.">
            <br><label>Endereço Eletronico:</label><br>
                <input class=longo type="text" name="mail" required placeholder="Informe e-mail do responsavel.">
            <br><label>Turma Pretendida:</label><br>
                <div>
                   <input type="radio" name="pretendido" value="bercario1" required checked>Berçario 1</input> 
                   <input type="radio" name="pretendido" value="bercario2" >Berçario 2</input>
                   <input type="radio" name="pretendido" value="maternal1">Maternal 1</input> 
                   <input type="radio" name="pretendido" value="maternal2">Maternal 2</input> 
                </div>
            <label>Escola:</label><br>
            <div>
                <input type="radio" name="escola" value="bemmequer" required checked>Bem me Quer</input>
            <div>                       
        <INPUT TYPE="submit" VALUE="Enviar"> 
        </fieldset>
    </form>
</div>
</body>
</html>
grv_matriculas.php
query($sql); 
$row = $resulta->fetch_assoc(); 
if ($resulta->num_rows > 0) { 
    $sql1 = "UPDATE lista SET aluno = '$aluno', responsavel = '$responsavel', endereco = '$endereco', fone = '$fone', mail = '$mail', pretendido = '$pretendido', escola = '$escola', dia_visita = '$dia_visita', hora_visita = '$hora_visita' WHERE cpf = '$cpf'": 
} else { 
    $sql1 = "INSERT INTO lista(aluno, cpf, responsavel, endereco, fone, mail, 
pretendido, escola, ip, dia_visita, hora_visita) VALUES ('$aluno', '$cpf', 
'$responsavel', '$endereco', '$fone', '$mail', '$pretendido', '$escola', '$ip', 
'$dia_visita', '$hora_visita')"); 
} 
$resultado = mysqli_query($conn, $sql1); 
echo $resultado; 
echo "alert('Gravado com Sucesso!);location.href='coloqueoarquivo.php';"; ?>
code to save
<?php
   include_once("conexao.php"); 
     $aluno=$_POST['aluno'];
     $cpf=$_POST['cpf'];
     $responsavel=$_POST['responsavel'];
     $endereco=$_POST['endereco'];
     $fone=$_POST['fone'];
     $mail=$_POST['mail'];
     $pretendido=$_POST['pretendido'];
     $escola=$_POST['escola'];
     $ip = $_SERVER['REMOTE_ADDR'];
     $dia_visita = date("d-m-y");
     $hora_visita = date("H:i:s");
     $oficial=$_POST['oficial'];
     $sql1=mysqli_query($conn, "INSERT INTO lista(aluno, cpf, responsavel, endereco, fone, mail, pretendido, escola, ip, dia_visita, hora_visita, oficial)VALUES('$aluno', '$cpf', '$responsavel', '$endereco', '$fone', '$mail', '$pretendido', '$escola', '$ip, '$dia_visita', '$hora_visita', '$oficial')");
        echo  "<script>alert('Gravado com Sucesso!);</script>";
        header("Location: /Central_de_Matriculas/Best")
?>
Inside the connection include is set to $Conn. What is wrong?
Any error message appears?
– Geraldão de Rívia
quote missing in $ip
– Victor
namoral, study a little PHP because, your code is poorly idented, you close the tag input thing I’ve never seen, gives long spaces, and also defined script language='Javascript', actually is <script type="text/javascript"> will be better for you otherwise it will always depend on someone fixing your codes
– Victor
Hello Victor, as I said I’m new here, and also in the area, but what I do not learn in colleges nowadays, I have to look outside, thank you very much for the help, know where else I can find material for study?
– Carlito Veeck Pautz
@Stormwind I copied this code from his own reply and had him remove the answer, then edited adding the data in the reply, and the grv_matricula file, if you repair it based on my reply however, edited and made unnecessary changes
– Victor
@Carlitoveeckpautz check my code and do what I have indicated, paste it into your database insertion file, and note that you have some posts that are not receiving anything through the form, this may be prevented you
– Victor
@Victor when it’s like that, comment on the field of justifying editing, there’s no way we can figure it out at the time of analysis. I was already reversing your edit.
– user28595
sorry had never caught a case of this, the person put the answer in the place of the question understands. but thanks @Articuno in a next I will put
– Victor