I am trying to get the information from my ajax into a PHP $_POST so that i can update my database.
HTML
<form id="23" method="post">
<select name="admin" onchange="chosenadmin(23)">
<option value="rick">rick</option>
<option value="john">john</option>
<option value="dick">dick</option>
</select>
</form>
AJAX
function changeadmin(verkochtid){
id = verkochtid;
console.log(id);
$.ajax({
url: 'winkels.php',
id: id,
type: 'POST',
data: $('#'+id).serialize(),
success: function(data, id){
console.log(this.data);
console.log(this.id);
}
});
};
PHP
if (isset($_POST["serialize"])) {
$data = $_POST["serialize"];
$medewerker = $data["chosen_admmin"];
$verkoopid = $data["id"];
$sql = "UPDATE verkocht SET medewerker_verwerkt = '$medewerker' WHERE verkocht_id='$verkoopid'";
echo $sql;
};
the PHP will never be executed but in the console log i get to see the id of the form and admin=rick.
I can tell from this that AJAX gets the information and procces it, but how do i set it in my PHP?