Field Alert

Asked

Viewed 42 times

0

This is guys speaking. I have a question, I would like to know how I do to display an alert Div next to an input if this field is not filled in or the informed data already exist in the database.`

        <form action="Cadastrado.php" method="POST">


            <input type="text" name="nome" placeholder="Nome" class="nome" id="nometeste" >


            <input type="text" name="sobrenome" placeholder="Sobrenome" class="sobrenome" >


            <input type="text" name="login" placeholder="Email" class="login" maxlength="40" >


            <input type="password" name="senha" placeholder="Senha" class="senha" maxlength="30" >

            <input type="submit" value="Cadastrar" class="botao">

        </form>

        </div>`
  • You can use the jQuery Validation, very simple to use and allows you to do remote validation, which is what you want to do when checking if the values are already in the database.

1 answer

0

To require the fields to be filled in you can add required input. It would look like this:

<input type="text" name="nome" placeholder="Nome" class="nome" id="nometeste" required>
  • So, I’d already done it that way, but he doesn’t compare the information to the database. With PHP I can make this comparison but can’t show a div of alert instead of showing a javascript Alert

Browser other questions tagged

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