i have 2 files : - form.php :
<html>
<head>
<link rel="stylesheet" type="text/css" href="bootstrap.min.css">
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<script>
$(function()
{
$('#r').click(function()
{
pseudo= $("#pseudo").val();
password= $("#password").val();
$.ajax({
type:"POST",
url:"insert.php",
data:'pseudo='+pseudo+'&password='password,
success:function(data)
{
if(data == 1)
{
alert("ddd");
}
else
{
alert("lll");
}
}
});
});
});
</script>
</head>
<body>
<center>
<form class="well form-inline" method="post" action="buscarUsuario.php">
<a class="btn btn-danger" href="" id="r">Save</a>
<input type="text" style="height: 30px" class="span4" placeholder="Pseudo" id="pseudo" />
<span id="error"></span>
<span id="ok"></span>
<input type="password" style="height: 30px" class="span4" placeholder="Password" id="password"/>
<button type="submit" style="width: 95px" class="btn btn-primary" value="Entrar" name="Entrar">Entrar</ button>
</form>
<center>
</body>
</html>
and i want to save pseudo and password in my data base through this file insert.php :
<?php
require "connecttoBD.php";
$pseudo= $_POST["pseudo"];
$password= $_POST["password"];
$sql="INSERT INTO usuarios (pseudo,password) VALUES ('$pseudo,$password') ";
$req=mysql_query($sql) or die (mysql_error());
echo "1";
?>
but when i fill out the 2 fields and press the button Save I have not saved the 2 fields in my data base. can anyone help me please ? thank you.