0
I have a user registration and I need an error message to appear if the user tries to register an email that already exists in the Bank. I wanted a message in the field itself. How can I do??
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Apitec</title>
<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="css/register.css">
</head>
<body>
<form method="post" action="api/cadastrarApicultorApiario.php" class="apicultor" style="top: 80%">
<img src="img/logo1.png" style="margin-bottom: 20px" alt="" width="150px">
<h3 style="margin-top: -10px; margin-bottom: 20px; font-size: 22px;" >Apicultor</h3>
<div id="MsgCadastroErro" class="alert alert-danger hide" role="alert">
Preencha todos os campos!
</div>
<div class="form-row">
<div class="form-group col-md-6">
<input name="nome_apicultor" type="text" class="form-control" id="nome_apicultor" placeholder="Nome*" required>
</div>
<div class="form-group col-md-6">
<input name="sobrenome_apicultor" type="text" class="form-control" id="sobrenome_apicultor" placeholder="Sobrenome*" required>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-6">
<input name="email_apicultor" type="email" class="form-control" id="email_apicultor" placeholder="E-mail*" required>
</div>
<div class="form-group col-md-6">
<input name="senha_apicultor" type="password" class="form-control" id="senha_apicultor" placeholder="Senha* - 8 dígitos" required maxlength="8">
</div>
</div>
<p style="font-size: 15px;">* Campos obrigatórios</p>
<button onclick="Registrar()" type="send" class="btn btn-warning btn-block" style="font-weight: bold;">Cadastrar</button>
</form>
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/popper.min.js"></script>
<script type="text/javascript" src="js/jquery.mask.min.js"></script>
<script type="text/javascript" src="js/bootstrap.min.js"></script>
<script type="text/javascript" src="js/register.js"></script>
<script type="text/javascript" src="js/celular_fixo_cadastro.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"></script>
</body>
</html>