2
I made a registration form where the user must fill name and CPF , and attach a photo of RG and another selfie.
I already created the database on mysql, however the submit
doesn’t work. When I remove the inputs file, then it works.
In the mysql I created two columns of the type blob to receive both images.
Does anyone know why Submit doesn’t work? The screen doesn’t update, just nothing happens.
Follow the form code below.
<form id="main-contact-form" action="cadastroAdd.php" method="post" enctype="multipart/form-data">
<input type="text" name="nome" id="nome" placeholder="Nome completo" required onkeyup="maiusculas()" autofocus> <b><font color="red">*</font></b><input type="hidden" name="prazo" id="prazo" ><br><br>
<input type="text" name="cpf" id="cpf" placeholder="CPF" required OnKeyPress="formatar('###.###.###-##', this)" maxlength="14"> <b><font color="red"> Menor de idade ou não tem CPF <input type="checkbox" name="menor" id="menor" value="-dependente"/>*</font></b><br>*Caso seja menor de idade e ainda não possua CPF, insira o CPF do Responsável. Vale ressaltar que a retirada do documento só poderá ser feita pelo titular do CPF cadastrado.<br><br>
<input type="text" name="nascimento" id="nascimento" placeholder="Data de Nascimento" required OnKeyPress="formatar('##/##/####', this)" maxlength="10"> <b><font color="red">*</font></b>
<br>
<br>
<input type="text" name="telefone" id="telefone" placeholder="Telefone(Whatsapp)" required OnKeyPress="formatar('##-#####-####', this)" maxlength="13"> <b><font color="red">*</font></b><br>
(99-99999-9999)
<br><br>
<input type="email" name="email" id="email" placeholder="E-mail"><br><br>
Adicione uma foto de rosto: <input type="file" name="foto" id="foto" class="anexo"> <b><font color="red">*</font></b><br><br>
Adicione uma imagem do seu documento com foto(RG ou CNH): <input type="file" name="documento" id="documento" class="anexo"> <b><font color="red">*</font></b><br><br>
<input type="submit" name="enviar" value="Enviar">
</form> <br><br>
php cadastre.
$conexao->query("set names utf8");
$nome = $_POST['nome'];
$cpf = $_POST['cpf'];
$nascimento = $_POST['nascimento'];
$telefone = $_POST['telefone'];
$email = $_POST['email'];
$prazo = $_POST['prazo'];
$foto = $FILE['foto'];
$documento = $FILE['documento'];
$menor = $_POST['menor'];
$sql = "INSERT INTO `epiz_24359771_paraqueradical`.`usuarios` (`nome`, `cpf`, `nascimento`, `telefone`, `email`, `prazo`) values ('$nome','$menor''$cpf','$nascimento','$telefone','$email','$prazo','$foto','$documento')";
$salvar = mysqli_query($conexao, $sql);
$linhas = mysqli_affected_rows($conexao);
mysqli_close($conexao);
?>
<?php
if ($linhas == 1) {
echo "Cadastro efetuado com Sucesso!!";
} else {
print "Cadastro não efetuado.";
}
?>
<a class="botao" href="cadastro.php"><input type="button" id="voltar" value="VOLTAR"></a>
Do you want with or without
type=files
?– MagicHat
with type files . I want you to upload everything to the mysql I’ve already created. ie. the 2 photos and user data
– Allan Cisneiro
Add the inputs you want to your code...
– MagicHat
are already there. are 5 inputs text , 1 checkbox and 2 files.
– Allan Cisneiro
How’s your
cadastroAdd.php
this is the file you are receiving and should process the request sent by the form and save the data in mysql.– Erlon Charles
I don’t see the change in the
enctype
...– MagicHat
Has problems in the register...
'$menor''$cpf'
has no comma in the Insert of this data. In addition you are trying to insert in 6 fields and sending 9 variables... This only in Insert. I think you’d better post the errors that are shown.– Andrei Coelho