I use this jquery to serialize my form and submit it to a PHP script called write.php;
$("form").submit(function(){ var_form_data = $(this).serialize(); $.ajax({ type: "POST", url: "write.php", data: var_form_data, success: function(msg){ alert( "Data Saved: " + msg ); } }); });
Usually, let's say I had a form with the Address F_name and S_name fields, I would do something like this to get the values ββin PHP vars;
$Address = $_POST["Address"]; $F_name = $_POST["F_name"]; $S_name = $_POST["S_name"];
I would continue this work with DB
However, this particular form may change regularly. Therefore, I would like to get all the data that was transmitted through the ajax request as a string that I can explode or an array.
Then I can iterate over the elements in the array and store them in the database one by one (I think!).
I hope this makes sense, if I missed something or you would like me to explain further, please let me know.
As always - all help is greatly appreciated.
source share