<form id="questions_1">
<div data-role="collapsible-set" data-theme="" data-content-theme="" id='q1'>
<!-- GETS QUESTIONS FROM THE DATABASE -->
</div>
</form>
So I have a form that goes on for 5 pages like shown above, and I want to save all the data from each step, I am thinking something along the lines of this to pass all the data for each form into a .php page:
function formSubmit1() {
$("#questions_1").submit(function() {
$.post('addToSession.php',$("#questions_1").serialize().function(data) {
});
return false;
});
}
By adding the following code to each “submit”/next page button I think I can call the function.
<a data-role="button" href="#questions_2" onClick=formSubmit1()>Next</a>
This might need some customization but the part I am really unsure about is how do I get all the data without knowing their id’s. The idea is to make the questions in this poll vary in order, size and questions so I need a general code that can handle any input.
Use
$_REQUESTto get data from forms on submit. After getting data$_SESSION['name'] = $_REQUEST.