Reputation: 1363
I have a form with some different input elements. One of these is a checkbox array. Adding another checkbox to the array using Jquery, without reloading the page I cannot see my checked checkbox on $_POST?
Is there any way to add extra input fields with values, and then catching these in a $_POST?
Thanks in advance
Upvotes: 0
Views: 69
Reputation: 1363
Thanks for your responses! I believe I didn't explain myself well enough, and that might have lead to some confusion.
I build the example from scratch, and that solves my question- it is doable. I must have some other code in my script that's preventing it from working.
See my example below: http://pastie.org/1077627
Upvotes: 1
Reputation: 57938
you should be able to see the checkboxes in that array given that:
Upvotes: 0
Reputation: 382696
Adding another checkbox to the array using Jquery, without reloading the page I cannot see my checked checkbox on $_POST?
You can not see/fill the super array $_POST
dynamically, you need to submit the form either via ajax or through a submit button.
The reason for this is that $_POST
is part of PHP not jQuery and since PHP is a server-side scripting language, you need to make a trip to the server.
In your case, you might want to submit the form via ajax, for example, jQuery's $.ajax
method and this will include newly as well as existing elements in the submission process.
Upvotes: 1