-3
My site has the login forms, the registration form and the "Recover my password", next to each other, I want to connect the registration form with my database, the login I have already managed, but the registration I have not yet managed, I intend to make a registration form using jQuery and Ajax, Can someone help me connect?
The name of my database is klp
and the name of my table is table
<section class="containerreg">
<h1><font color="#fb6e14">Sign Up</font></h1>
<p id="cadastra"> </p>
<form id="cadastra_user" method="POST" action="">
<p><input type="text" name="name" value="" placeholder="Complet name"></p>
<p><input type="text" name="user" value="" placeholder="Username"></p>
<p><input type="text" name="email" value="" placeholder="E-mail"></p>
<p><input type="password" name="senha" value="" placeholder="Password"></p>
<button type="submit" value="Enviar" class="btn btn-primary" />Sign Up</button>
</form>
</section>
<script type="text/javascript">
$(function(){
$('#cadastra_user').submit(function(event){
event.preventDefault();
var formDados new FormData($(this)[0]);
$.ajax({
url:'http://127.0.0.1/projects/foodee/addUsuario.php',
type:'POST',
data:formDados,
cache:false,
contentType:false,
processData:false,
success: function(data){
$('#cadastra').html(data);
alert('Cadastrado com sucesso!');
},
dataType: 'html'
});
return false;
});
});
</script>
This was the connection page for the registration that was sampled in the video, but it doesn’t seem to work
Is there something missing from the video? Can someone please help me because I don’t know what to do to make it work https://www.youtube.com/watch?v=R9AY97_yvpo
Type, agr until it is appearing that was registered (image 1), but nothing appears in my comic (image 2) and the business is that I have the right connections in the comic, both registration and login (images 3 and 4)... from now on, I thank everyone who is helping me and trying to help me
I don’t understand anything, edit your question, it’s too wide.
– user94336
Could you improve the text of your doubt? Your title is totally non-specific and I see a lot of dirt in your text. And your code is not properly marked as code by the markdown (hint, select the code snippet and press
ctrl+k
)– Jefferson Quesado
By the second photo I could observe that you are not declaring the variables, it may be that the form that Voce created is with the inputs of the same name as the one of the registration, ex: in the first form(login) has input with the name="user" and in the registration form has an input with the same name, he is taking the value of the first form
– Matheus Lopes Marques
But like, if inputs of the same name are not used in both registration and login, you will not be able to record the information in the right places
– Renan Henrique
Thanks for the personal help
– Renan Henrique
i want to connect the registration form with my database, the login I have already managed, I intend to make a registration using Jquery and Ajax so that when clicking the button "Sign up", the page does not need to reload. As Anderson Henrique said, the problem for the registration message was in the java script, however, even if the client’s registration message appears, the information is not inserted in my table (table) of my database (klp), if you want to see the code prints, I put it down there so if anyone has any questions about the codes... thank you
– Renan Henrique