If you have many form fields, don’t collect them all individually, do it in one go using the Serialize function.
Remember to add the forms id
1 2 3 |
<form id="myform"> |
1 2 3 4 5 6 |
var data = $('#myform').serializeArray(); data.push({name: 'idnumber', value: idnumber}); $.post("page.php", data); |
Basic Version
1 2 3 4 5 6 7 8 9 10 |
var formdata = $("#myformaddjob").serialize(); alert(formdata); $.post("submitjobtodb.php", $("#myformaddjob").serialize(), function(data) { alert(data); } ); |
To collect posted fields in PHP use this script.