Reputation: 13
I know that the PHP scripts work because I tested them without jQuery therefore I think something wrong with my jQuery.
<form id="bakery" name="bakery" method="POST" action="bakeryupdate.php">
<select id="bakeryid" name="bakeryid">
<option value="">Select</option>
</select>
<input type="submit" value="Submit" name="submit" id="bakeryupdatebutton" />
</form>
$(document).ready(function() {
$.ajax({
type:'POST',
url:'bakeryupdate.php',
data: {bakeryid:bakeryid}
}).done(function(){
$('#success').text('success!');
});
}
e.preventDefault();
});
});
update data php script
<?php
if(isset($_POST['submit'])) {
$sql = "UPDATE bakeryorders SET description='shipped";
if (mysqli_query($con, $sql)) {
echo "Bakery order updated";
} else {
echo "Error!";
}
}
?>
Upvotes: 0
Views: 98
Reputation: 21004
Make sure to commit
the transaction if you don't have autocommit...
mysqli->commit();
Upvotes: 1