Hola amgios tengo un problema en ajax al insertar un nuevo registro
mi codigo en registro
el probelama es q no me rellena el usuario y el email
en la pagina de registro
mi codigo en registro
el probelama es q no me rellena el usuario y el email
<?php require_once('../Connections/conexion.php'); ?>
<?php
$usuario = utf8_decode($_POST['usuario']);
$email = ($_POST['email']);
$password = sha1($_POST['password']);
$codigo =uniqid(55331-3394);
?>
<?php
$insertSQL ="INSERT INTO r_users (usuario, email, password) VALUES ('$usuario','$email','$password')";
mysql_select_db($database_conexion, $conexion);
$Result1 = mysql_query($insertSQL, $conexion) or die(mysql_error());
?>
en la pagina de registro
<?php require("Connections/Conexion.php"); ?>
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript">
var urlWeb= 'http://localhost/web/';
$(document).ready(function() {
$('.error').hide();
$("#enviar-btn").click(function() {
var dataString = '&nombre=' + nombre + '&email=' + email + '&password=' + password;
$.ajax({
type: "POST",
url: urlWeb + "inc/registro.php",
data: dataString,
success: function() {
$('#register_form').html("<div id='message'></div>");
$('#message').html("<h2>Tus datos han sido guardados correctamente!</h2>")
.hide()
.fadeIn(1500, function() {
$('#message').append("<a href='index.php?action=see'>Ver usuarios registrados</a>");
});
}
});
return false;
});
});
runOnLoad(function(){
$("input#name").select().focus();
});
</script>
<div id="register_form">
<form name="register" method="post" action="">
<input name="" id="nombre" type="text">
<br>
<input name="" id="email" type="text">
<input name="password" id="password" value="<?php echo $_GET['user']?>" type="text"><br>
<input name="submit" type="submit" value="enviar" id="enviar-btn" />
</form>
</div>0
Puntos
Puntos
1291
Visitas
Visitas
3
Resp
Resp
Por fc2014 hace 11 años
Master
Respuesta #1
Hola fc2014, ahí está. A primera vista se ve que en el input de Email y en el input de Nombre olvidaste rellenar el campo name
Jajaja, saludos :D
<input name="" id="nombre" type="text"> <br> <input name="" id="email" type="text">En tu caso, sería rellenarlo así.
<input name="usuario" id="nombre" type="text"> <br> <input name="email" id="email" type="text">
Jajaja, saludos :D
5
Puntos
Puntos
Por jose hace 11 años
Master
Respuesta #2
exacto prueba como te contesto Jose ;)
0
Puntos
Puntos
Por alber hace 11 años
Admin
Respuesta #3
Ahi gracias amigos igual ya pude resolverlo era q tenia en el login el mismo id en el de registro en registro le mande nombreajax en el login nombre
Gracias Saludos
Gracias Saludos
5
Puntos
Puntos
Por fc2014 hace 11 años
Master