I'm trying to POST from my program to a separate PHP file, then grab that data and store it into my SQL database. I've checked my code over and over and can't' find what I'm doing wrong. Any help would be appreciated.
AJAX
$(".btn btn-success last").click(function(){
$.post("go2.php",
{
name: "Donald Duck",
city: "Duckburg"
},
function(data, status){
alert("Data: " + data + "
Status: " + status);
});
});
PHP file (go2.php) w/ SQL code
<?php
include 'connection.php';
$x = $_POST["name"];
$sql = "INSERT INTO users (Username) VALUES ('$x') ";
$query = mysql_query($sql);
?>