I have seen many tutorials, but they\'re so confusing, and to do what I want to do, I just don\'t get how to use existing stuff from those tutorials and make them work they
The jQuery part is often quite simple. It just redirects the ordinary form action= over a Javascript handler. $.post
is easy to use and you just need .serialize()
to package up the existing form values into a string:
And on PHP side you simply receive the content via $_POST
and save it to the database (using the old mysql_ functions would also be possible, just more cumbersome):
$db = new PDO("mysql:...");
if ($_POST["submitbuttonname"]) {
$q = $db->prepare("INSERT INTO save (textbox, label) VALUES (?, ?)";
$q->execute(array($_POST["textbox"], $_POST["label"]));