I appreciate all the help I might get.
I'm trying to save some user settings on focusout with serialize method, but I can't get the variable into the PHP.
<form id ="form1">
<input type="text" id="content" value="myvalue">
</form>
<script>
$("#form1").focusout(function(){
$.ajax({
type: "POST",
url: "save.php",
data: $("#form1").serialize(),
success: function(){
}
});
});
</script>
save.php:
$content = $_POST['content'];
$sql = "UPDATE test_table SET color = '$content' WHERE id = 0";
$execute = mysqli_query($mysqli_connect,$sql);
If I set the $content
manually ($content = 'bbb';
) it writes it to DB normally. So I guess I'm not retrieving variables in the right way?