I have jQuery to submit 'N' number of forms. Now I need to read the POST values based on the number of components. Can anyone suggest code to read those all POST values?
especially i want to read approve1 , approve2 ... values
Note: when i click submit all these different form values are submitted to submit.php page
My Form:
<form name="f1" action="submit.php" method=POST>
<input type="hidden" name="approve1" value="93545" />
<input type="submit" value="Submit/>
</form>
<form name="f2" action="submit.php" method=POST>
<input type="hidden" name="approve2" value="93545" />
<input type="submit" value="Submit/>
</form>
.....
<input type="button" value="Submit All"/>
jQuery:
$(function() {
$("#submitAll").click(function(ev) {
ev.preventDefault();
var newForm = $("<form action='submit.php' method='POST'></form>");
$("form input[type='hidden']").each(function(i, e) {
newForm.append(
$("<input type='hidden' />")
.attr("name", e.name)
.attr("value", e.value)
);
});
$(document.body).append(newForm);
newForm.submit();
});
});
foreach($_POST as $name => $value) posts only last form value i.e approve2 value in this example
$_POST['approve1']and$_POST['approve2']N approvePOST values. How should it find it ?