Send "POST" data using checkbox and PHP
Send "POST" data using checkbox and PHP
leandrorius
Posts: 1Questions: 0Answers: 0
Hi there! I wonder if my question is dumb, but I really tried a lot of things I didn't manage to solve this.
I have dynamic table with about 200 rows inside a form, and the first columns of each row are checkbox.
This is the form:
[code]
[/code]
And two examples of my table:
[code]
Item 1
Item 2
[/code]
I need to send all this information via "POST" method to another page. If I use only the "Submit", the variable $_POST['code'] on "test.php" only gets the itens that were displayed on screen when I submitted the form.
Ok, so I tried to use this example here (http:/datatables.net/release-datatables/examples/api/form.html) using this code:
[code]
$(document).ready(function() {
$('#myform').submit( function() {
var sData = $('input', oTable.fnGetNodes()).serialize();
alert( "The following data would have been submitted to the server: \n\n"+sData );
return false;
} );
[/code]
That works great on alert. But I'm still stucked, cause I don't know how to pass this values to test.php via POST.
I know it's kind simple, but I'm new to Javascript and Datatables, and I did a search in the forum pretty hard and I found a lot of complex examples that I didn't understand.
Thanks!
I have dynamic table with about 200 rows inside a form, and the first columns of each row are checkbox.
This is the form:
[code]
[/code]
And two examples of my table:
[code]
Item 1
Item 2
[/code]
I need to send all this information via "POST" method to another page. If I use only the "Submit", the variable $_POST['code'] on "test.php" only gets the itens that were displayed on screen when I submitted the form.
Ok, so I tried to use this example here (http:/datatables.net/release-datatables/examples/api/form.html) using this code:
[code]
$(document).ready(function() {
$('#myform').submit( function() {
var sData = $('input', oTable.fnGetNodes()).serialize();
alert( "The following data would have been submitted to the server: \n\n"+sData );
return false;
} );
[/code]
That works great on alert. But I'm still stucked, cause I don't know how to pass this values to test.php via POST.
I know it's kind simple, but I'm new to Javascript and Datatables, and I did a search in the forum pretty hard and I found a lot of complex examples that I didn't understand.
Thanks!
This discussion has been closed.