registration form ,does not present error,and goes to index/ But does not register

Asked

Viewed 49 times

-2

FORM/INSIDE A PAGE

<!-- Page Content
================================================== -->
<div class="container">
    <div class="row">
        <div class="col-xl-5 offset-xl-3">

            <div class="login-register-page">
                <!-- Welcome Text -->
                <div class="welcome-text">
                    <h3 style="font-size: 26px;">Vamos criar sua conta!</h3>
                    <span>Already have an account? <a href="pages-login.html">Log In!</a></span>
                </div>

                <!-- Account Type -->
                <div class="account-type">
                    <div>
                        <input type="radio" name="account-type-radio" id="freelancer-radio" class="account-type-radio" checked/>
                        <label for="freelancer-radio" class="ripple-effect-dark"><i class="icon-material-outline-account-circle"></i> Freelancer</label>
                    </div>

                    <div>
                        <input type="radio" name="account-type-radio" id="employer-radio" class="account-type-radio"/>
                        <label for="employer-radio" class="ripple-effect-dark"><i class="icon-material-outline-business-center"></i> Employer</label>
                    </div>
                </div>

                <!-- Form -->
                <form method="POST" action="processa.php">
                    <div class="input-with-icon-left">
                        <label>E-mail: </label>
                        <input type="email" name="email" placeholder="seu email"><br><br>

                    <div class="input-with-icon-left" title="Should be at least 8 characters long" data-tippy-placement="bottom">
                        <label>senha: </label>
                        <input type="text" name="text" placeholder="sua senha"><br><br>

                    <div class="input-with-icon-left">
                        <label>senha: </label>
                        <input type="text" name="nome" placeholder="repita sua senha"><br><br>

                        <input type="submit" value="Cadastrar">
                    </form>
                </body>
            </html>

                <!-- Button -->
                <button class="button full-width button-sliding-icon ripple-effect margin-top-10" type="submit" form="login-form">Cadastrar <i class="icon-material-outline-arrow-right-alt"></i></button>

                <!-- Social Login -->
                <div class="social-login-separator"><span>or</span></div>
                <div class="social-login-buttons">
                    <button class="facebook-login ripple-effect"><i class="icon-brand-facebook-f"></i> Register via Facebook</button>
                    <button class="google-login ripple-effect"><i class="icon-brand-google-plus-g"></i> Register via Google+</button>
                </div>
            </div>

        </div>
    </div>
</div>
----------------------------------------------------------------------------

CODIGO PROCESSA

    <?php

        $vemail = filter_input(INPUT_POST, 'email');
        $senha = filter_input(INPUT_POST, 'senha');
        $senha = filter_input(INPUT_POST, 'senha');

         //echo "email:  .$email.<br>";
         //echo "senha:  .$senha.<br>";
         //echo "senha:  .$senha.<br>";


         $result_usuario = "INSERT INTO usuarios (nome, email, created) VALUES ('$email', '$senha', NOW())";
         $resultado_usuario = mysqli_query($conn, $result_usuario);

         if(mysqli_insert_id($conn)){
             $_SESSION['msg'] = "<p style='color:green;'>Usuário cadastrado com sucesso</p>";
             header("Location: index-logged-out.html");
         }else{
             $_SESSION['msg'] = "<p style='color:red;'>Usuário não foi cadastrado com sucesso</p>";
             header("Location: index.html");
         }     
    ?>

CONNECTION CODE

<?php
$servidor = "X";
$usuario = "X";
$senha = "X";
$dbname = "usuarios";

//Criar a conexao
$conn = mysqli_connect($servidor, $usuario, $senha, $senha, $dbname);

It does not warn that gave error,nor says it was registered, goes to page index (where I directed if not right)I do not know which error,I’ve made a second form,but gave the same thing thought if it would be in the database.

inserir a descrição da imagem aqui

1 answer

0

Hello, as far as I can tell, there’s a problem with assigning variables with the values coming from the form. To access the data of the super global pole do the following:

$email = $_POST[‘email’];

On the other hand in HTML, the input name: are they who took the information by the super global _POST, so it is necessary to rename and assign better in the PHP page. I will make corrections to the form above if you prefer

Browser other questions tagged

You are not signed in. Login or sign up in order to post.